Fix casting of SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD #1213

Closed
opened 2025-11-11 14:40:16 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @jeremi on GitHub (Jun 12, 2024).

When setting in the environment SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD to 100 for example, I get the following error:

open-webui  |   File "/app/backend/main.py", line 609, in generate_search_query
open-webui  |     if len(form_data["prompt"]) < app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD:
open-webui  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In config.py, there is a need to cast the value to int to fix it:
4a025cca00 (diff-651976572b51d1a16ede6a1c4c1be9a1482605ce57ca58fbfca25e4a55c43210L676)

Originally created by @jeremi on GitHub (Jun 12, 2024). When setting in the environment SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD to 100 for example, I get the following error: ``` open-webui | File "/app/backend/main.py", line 609, in generate_search_query open-webui | if len(form_data["prompt"]) < app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD: open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` In config.py, there is a need to cast the value to int to fix it: https://github.com/open-webui/open-webui/commit/4a025cca00a8ae1e7cbc8979ea435bcf78033f10#diff-651976572b51d1a16ede6a1c4c1be9a1482605ce57ca58fbfca25e4a55c43210L676
Author
Owner

@tjbck commented on GitHub (Jun 12, 2024):

Good catch, Thanks!

@tjbck commented on GitHub (Jun 12, 2024): Good catch, Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1213