mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-21 04:31:59 +08:00
feat: optimize tool selection middleware to cache and reuse tool selection per agent run
- Refactor MoviePilotToolSelectorMiddleware to perform tool selection once per agent execution and cache the result in state, avoiding redundant LLM calls for each model round. - Add abefore_agent to select tools at the start of agent execution and store selected tool names in state. - Update awrap_model_call to reuse cached tool selection from state for subsequent model calls. - Enhance test coverage for tool selection caching and reuse logic. - Improve error logging in skill version extraction.
This commit is contained in:
@@ -451,6 +451,7 @@ class MoviePilotAgent:
|
||||
model=non_streaming_model,
|
||||
max_tools=max_tools,
|
||||
always_include=always_include_tools,
|
||||
selection_tools=tools,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user