Skip to content

Commit

Permalink
Merge pull request open-webui#4798 from open-webui/dev
Browse files Browse the repository at this point in the history
fix: filter compatibility issue
  • Loading branch information
tjbck authored Aug 21, 2024
2 parents 847ca66 + 6fcd40d commit e2b7296
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,8 @@ async def dispatch(self, request: Request, call_next):
"chat_id": body.pop("chat_id", None),
"message_id": body.pop("id", None),
"session_id": body.pop("session_id", None),
"valves": body.pop("valves", None),
"tool_ids": body.pop("tool_ids", None),
"files": body.pop("files", None),
"tool_ids": body.get("tool_ids", None),
"files": body.get("files", None),
}
body["metadata"] = metadata

Expand Down Expand Up @@ -560,6 +559,13 @@ async def dispatch(self, request: Request, call_next):
content={"detail": str(e)},
)

metadata = {
**metadata,
"tool_ids": body.pop("tool_ids", None),
"files": body.pop("files", None),
}
body["metadata"] = metadata

try:
body, flags = await chat_completion_tools_handler(body, user, extra_params)
contexts.extend(flags.get("contexts", []))
Expand Down

0 comments on commit e2b7296

Please sign in to comment.