From d47c8eb956a72ebc7c1f582718758697aef62118 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 5 Jun 2025 06:56:24 -0700 Subject: [PATCH] Remove quotes from LLM-generated websearch query (closes #7045). Fix by @Quiet-Joker --- modules/chat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index f1ea16f1..14f2a4f7 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -604,7 +604,12 @@ def generate_search_query(user_message, state): query = "" for reply in generate_reply(formatted_prompt, search_state, stopping_strings=[], is_chat=True): - query = reply.strip() + query = reply + + # Strip and remove surrounding quotes if present + query = query.strip() + if len(query) >= 2 and query.startswith('"') and query.endswith('"'): + query = query[1:-1] return query