fix(anthropic): satisfy basedpyright loop binding rules

This commit is contained in:
amazingniuma-art 2026-09-27 17:57:09 +08:00
parent a62b79b90c
commit cb8d5f42d8
2 changed files with 3 additions and 3 deletions

View file

@ -2407,7 +2407,7 @@ def anthropic_messages_pt(
) = messages[msg_i]
if user_message_types_block["role"] == "user":
if isinstance(user_message_types_block["content"], list):
user_content_start: Final = len(user_content)
user_content_start: int = len(user_content)
for m in user_message_types_block["content"]:
if m.get("type", "") == "image_url":
m = cast(ChatCompletionImageObject, m)
@ -2691,7 +2691,7 @@ def anthropic_messages_pt(
): # IMPORTANT: ADD THIS FIRST, ELSE ANTHROPIC WILL RAISE AN ERROR
assistant_content.extend(thinking_blocks)
if _content_is_list and _content_list is not None:
assistant_content_start: Final = len(assistant_content)
assistant_content_start: int = len(assistant_content)
for m in _content_list:
if not isinstance(m, dict):
continue

View file

@ -1719,7 +1719,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
anthropic_system_message_content["cache_control"] = system_message_block["cache_control"]
anthropic_system_message_list.append(anthropic_system_message_content)
elif isinstance(message["content"], list):
content_start: Final = len(anthropic_system_message_list)
content_start: int = len(anthropic_system_message_list)
for _content in message["content"]:
# Skip empty text blocks - Anthropic API raises errors for empty text
text_value = _content.get("text")