Skip to content

Refactor fetch_url and handle search result structures#5

Open
lyesrock wants to merge 1 commit into
Davixk:mainfrom
lyesrock:patch-1
Open

Refactor fetch_url and handle search result structures#5
lyesrock wants to merge 1 commit into
Davixk:mainfrom
lyesrock:patch-1

Conversation

@lyesrock
Copy link
Copy Markdown

I have fixed the two issues identified in the auto_web_search.py script:

Issue 1: URLs without a Protocol
Solution: I modified the fetch_url function to automatically add the https:// protocol if it is missing. This allows URLs like github.com to be accepted instead of having to enter https://github.com .

Issue 2: "'docs'" Error in Native Mode
Cause: The error occurred when the "Ignore Embedding and Retrieval" option was disabled in OpenWebUI. In this scenario, the result of process_web_search did not have the expected structure with the "docs" key.

Solution: I improved the native_web_search function to handle several possible result structures:

Normal structure with the "docs" key

Alternative structure with the "results" or "items" keys

Handling of cases where no data is returned

This fix makes the script more robust and compatible with different OpenWebUI configurations, which resolves the error encountered during native mode searches.

I have fixed the two issues identified in the auto_web_search.py script:

Issue 1: URLs without a Protocol
Solution: I modified the fetch_url function to automatically add the https:// protocol if it is missing. This allows URLs like github.com to be accepted instead of having to enter https://github.com .

Issue 2: "'docs'" Error in Native Mode
Cause: The error occurred when the "Ignore Embedding and Retrieval" option was disabled in OpenWebUI. In this scenario, the result of process_web_search did not have the expected structure with the "docs" key.

Solution: I improved the native_web_search function to handle several possible result structures:

Normal structure with the "docs" key

Alternative structure with the "results" or "items" keys

Handling of cases where no data is returned

This fix makes the script more robust and compatible with different OpenWebUI configurations, which resolves the error encountered during native mode searches.
@Davixk
Copy link
Copy Markdown
Owner

Davixk commented Nov 27, 2025

thank you!

explicit searxng support isn't planned for this extension, because it's already natively supported by Open WebUI, making it redundant.

if you could remove that, I'll test and merge this.

@lyesrock
Copy link
Copy Markdown
Author

I added SearxNG support initially because native search wasn’t working on my end. I’ve now fixed it — the native search works reliably, so we no longer need the SearxNG mode. I’ve removed the corresponding commit.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants