Refactor fetch_url and handle search result structures#5
Open
lyesrock wants to merge 1 commit into
Open
Conversation
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.
Owner
|
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. |
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.