Xueheng-Li / SynologyChatbotGPT

A multi-talented chatbot that integrates OpenAI api and Synology Chat.
https://github.com/Xueheng-Li/SynologyChatbotGPT
MIT License
160 stars 30 forks source link

当输入dd使用搜索引擎时报错 #33

Closed jesse031app closed 1 year ago

jesse031app commented 1 year ago

Search keywords: synology Searching... ERROR:duckduckgo_search.utils: Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 39, in _get_vqd vqd_index_start = resp.content.index(b"vqd='") + 5 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: subsection not found WARNING:duckduckgo_search.utils:keywords=synology. _get_vqd() is None. Refresh SESSION and retry... ERROR:duckduckgo_search.utils: Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 39, in _get_vqd vqd_index_start = resp.content.index(b"vqd='") + 5 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: subsection not found WARNING:duckduckgo_search.utils:keywords=synology. _get_vqd() is None. Refresh SESSION and retry... ERROR:talentBot:Exception on /webhook [POST] Traceback (most recent call last): File "/Users/jesse/ChatGPT/SynologyChatbotGPT/my_module.py", line 747, in search ddg_results = my_ddg(keywords, n=num_results) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jesse/ChatGPT/SynologyChatbotGPT/my_module.py", line 253, in my_ddg for r in search_results: TypeError: 'NoneType' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jesse/ChatGPT/SynologyChatbotGPT/talentBot.py", line 54, in webhook output = bots[user_id].process(message, num_search_results=5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jesse/ChatGPT/SynologyChatbotGPT/my_module.py", line 653, in process self.search( File "/Users/jesse/ChatGPT/SynologyChatbotGPT/my_module.py", line 751, in search print(f"Error: {e}; ddg_results = {ddg_results}") ^^^^^^^^^^^ UnboundLocalError: cannot access local variable 'ddg_results' where it is not associated with a value