From 447770efdcb053e04dda505a5b66d8cac738542d Mon Sep 17 00:00:00 2001 From: Joseph Cheung Date: Fri, 24 Feb 2023 18:52:57 +0800 Subject: [PATCH] Update webapp.py --- searx/webapp.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/searx/webapp.py b/searx/webapp.py index b572817e3..bb430d897 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -744,6 +744,7 @@ def search(): number_of_results = 0 # OPENAI GPT + raws = [] try: url_pair = [] prompt = "" @@ -770,6 +771,7 @@ def search(): tmp_prompt = res['title'] +'\n'+ res['content'] + '\n' + new_url +'\n' if original_search_query == search_query.query and len( prompt + tmp_prompt +'\n' + "\n以上是关键词 " + original_search_query + " 的搜索结果,删除无关内容,用简体中文分条总结简报,在文中用(链接)标注对应内容来源链接,链接不要放在最后。结果:" ) <2000: + raws.append(tmp_prompt) prompt += tmp_prompt +'\n' if len( prompt + tmp_prompt +'\n' + "\n以上是任务 " + original_search_query + " 的网络知识。用简体中文完成任务,如果使用了网络知识,删除无关内容,在文中用(链接)标注对应内容来源链接,链接不要放在最后。结果:") <2000: prompt += tmp_prompt +'\n' @@ -805,7 +807,7 @@ def search(): "logprobs": 0, "stream": True } - gpt = json.dumps({'data':gpt_data, 'url_pair':url_pair}) + gpt = json.dumps({'data':gpt_data, 'url_pair':url_pair, 'raws': raws}) gpt = '
' + r'''