mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00:00
fix: tool server tools change their schema on every restart and break prompt caching (#33000)
The required parameters of OpenAPI tool server tools, Open Terminal included, were sent to the model in a random order that could change every time Open WebUI restarted. The tool list sits at the start of every prompt, so a different order made every prefix cache on the model side miss, and long chats were processed again from scratch after a restart. The required parameters now keep the order the tool server declares, so the tool list stays identical across restarts.
This commit is contained in:
parent
a6cf0b23ab
commit
ee7c9ff5c1
1 changed files with 1 additions and 1 deletions
|
|
@ -1285,7 +1285,7 @@ def convert_openapi_to_tool_payload(openapi_spec):
|
|||
tool['parameters']['properties'].update(resolved_schema['properties'])
|
||||
if 'required' in resolved_schema:
|
||||
tool['parameters']['required'] = list(
|
||||
set(tool['parameters']['required'] + resolved_schema['required'])
|
||||
dict.fromkeys(tool['parameters']['required'] + resolved_schema['required'])
|
||||
)
|
||||
elif resolved_schema.get('type') == 'array':
|
||||
tool['parameters'] = resolved_schema # special case for array
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue