Update webapp.py

This commit is contained in:
Joseph Cheung 2023-02-20 21:06:47 +08:00
parent d2be38fd5f
commit e753999663

View file

@ -743,12 +743,12 @@ def search():
number_of_results = 0 number_of_results = 0
# OPENAI GPT # OPENAI GPT
if number_of_results != 0:
url_pair = {} url_pair = {}
prompt = "" prompt = ""
for res in results: for res in results:
if 'url' not in res: continue if 'url' not in res: continue
if 'content' not in res: continue if 'content' not in res: continue
if 'title' not in res: continue
if res['content'] == '': continue if res['content'] == '': continue
new_url = 'https://url'+str(len(url_pair)+1) new_url = 'https://url'+str(len(url_pair)+1)
url_pair[new_url] = res['url'] url_pair[new_url] = res['url']
@ -770,7 +770,7 @@ def search():
} }
if original_search_query != search_query.query: if original_search_query != search_query.query:
gpt_data = { gpt_data = {
"prompt": prompt+"\n以上是问题 " + original_search_query + " 的搜索结果,用简体中文分条总结问题的答案在文中用markdown脚注指对应内容来源链接", "prompt": prompt+"\n以上是问题 " + original_search_query + " 的搜索结果,用简体中文分条总结简报在文中用markdown脚注指对应内容来源链接",
"max_tokens": 1000, "max_tokens": 1000,
"temperature": 0.7, "temperature": 0.7,
"top_p": 1, "top_p": 1,