feat: optimize vision tools and image handling

- Add model-aware vision tool loading based on supports_vision flag
- Move view_image_tool from config to builtin tools for dynamic inclusion
- Add timeout to image search to prevent hanging requests
- Optimize image search results format using thumbnails
- Add image validation for reference images in generation
- Improve error handling with detailed messages

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hetao
2026-01-29 14:57:26 +08:00
parent 2c6dbbe065
commit 314ea41781
5 changed files with 59 additions and 19 deletions

View File

@@ -230,7 +230,7 @@ def make_lead_agent(config: RunnableConfig):
print(f"thinking_enabled: {thinking_enabled}, model_name: {model_name}, is_plan_mode: {is_plan_mode}")
return create_agent(
model=create_chat_model(name=model_name, thinking_enabled=thinking_enabled),
tools=get_available_tools(),
tools=get_available_tools(model_name=model_name),
middleware=_build_middlewares(config),
system_prompt=apply_prompt_template(),
state_schema=ThreadState,