联网搜索问题

This commit is contained in:
Your Name
2023-04-20 22:30:10 +08:00
parent bff4a87914
commit 325406a650
2 changed files with 14 additions and 8 deletions

View File

@@ -70,14 +70,14 @@ def 连接网络回答问题(txt, llm_kwargs, plugin_kwargs, chatbot, history, s
history = []
# ------------- < 第2步依次访问网页 > -------------
max_search_result = 5
max_search_result = 4 # 最多收纳多少个网页的结果
for index, url in enumerate(urls[:max_search_result]):
res = scrape_text(url['link'], proxies)
history.extend([f"{index}份搜索结果", res])
chatbot.append([f"{index}份搜索结果", res])
history.extend([f"{index}份搜索结果", res])
chatbot.append([f"{index}份搜索结果", res[:500]])
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 由于请求gpt需要一段时间我们先及时地做一次界面更新
# ------------- < 第3步综合 > -------------
# ------------- < 第3步ChatGPT综合 > -------------
i_say = f"从以上搜索结果中抽取信息,然后回答问题:{txt}"
i_say, history = input_clipping(inputs=i_say, history=history, max_token_limit=model_info[llm_kwargs['llm_model']]['max_token']//2)
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(