diff --git a/astrbot/core/agent/handoff.py b/astrbot/core/agent/handoff.py index 0363e2d55..aebcdcb5d 100644 --- a/astrbot/core/agent/handoff.py +++ b/astrbot/core/agent/handoff.py @@ -15,7 +15,6 @@ class HandoffTool(FunctionTool, Generic[TContext]): tool_description: str | None = None, **kwargs, ) -> None: - # Avoid passing duplicate `description` to the FunctionTool dataclass. # Some call sites (e.g. SubAgentOrchestrator) pass `description` via kwargs # to override what the main agent sees, while we also compute a default diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index 39bfc69db..d4436f871 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -589,7 +589,10 @@ class ProviderOpenAIOfficial(Provider): def _extract_usage(self, usage: CompletionUsage | dict) -> TokenUsage: ptd = getattr(usage, "prompt_tokens_details", None) cached = getattr(ptd, "cached_tokens", 0) if ptd else 0 - prompt_tokens = getattr(usage, "prompt_tokens", 0) or 0 + cached = ( + cached if isinstance(cached, int) else 0 + ) # ptd.cached_tokens 可能为None + prompt_tokens = getattr(usage, "prompt_tokens", 0) or 0 # 安全 completion_tokens = getattr(usage, "completion_tokens", 0) or 0 cached = cached or 0 prompt_tokens = prompt_tokens or 0 diff --git a/astrbot/core/utils/requirements_utils.py b/astrbot/core/utils/requirements_utils.py index e031de846..f2c749db1 100644 --- a/astrbot/core/utils/requirements_utils.py +++ b/astrbot/core/utils/requirements_utils.py @@ -394,7 +394,6 @@ def find_missing_requirements(requirements_path: str) -> set[str] | None: def find_missing_requirements_from_lines( requirement_lines: Sequence[str], ) -> set[str] | None: - required = list(iter_requirements(lines=requirement_lines)) if not required: return set()