fix: invoke_llm failed when use plugin

This commit is contained in:
WangCham
2026-03-09 12:16:53 +08:00
parent 9148e02679
commit 2b8bd1cc71
2 changed files with 47 additions and 15 deletions

View File

@@ -337,7 +337,17 @@ class RuntimeConnectionHandler(handler.Handler):
)
messages_obj = [provider_message.Message.model_validate(message) for message in messages]
funcs_obj = [resource_tool.LLMTool.model_validate(func) for func in funcs]
# The func field is excluded during model_dump() in plugin side (marked as exclude=True),
# but it's a required field for LLMTool validation. We need to provide a placeholder
# function when reconstructing the LLMTool objects from serialized data.
async def _placeholder_func(**kwargs):
pass
funcs_obj = [
resource_tool.LLMTool.model_validate({**func, 'func': _placeholder_func})
for func in funcs
]
result = await llm_model.provider.invoke_llm(
query=None,