From 3342be4f5b0aa7f4e166157c0794ca3fa6495228 Mon Sep 17 00:00:00 2001 From: H Vs Date: Fri, 13 Sep 2024 16:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E6=9E=90prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/sum4all/config.json | 10 +++++----- plugins/sum4all/sum4all.py | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/sum4all/config.json b/plugins/sum4all/config.json index e4ce920..f2fb489 100644 --- a/plugins/sum4all/config.json +++ b/plugins/sum4all/config.json @@ -21,10 +21,10 @@ "max_file_size": "15000", "group": true, "qa_prefix":"", - "prompt": "你是一个新闻专家,我会给你发一些网页内容,请你用简单明了的语言做总结。格式如下:📌总结\n一句话讲清楚整篇文章的核心观点,控制在30字左右。\n\n💡要点\n用数字序号列出来3-5个文章的核心内容,尽量使用emoji让你的表达更生动" + "prompt": "" }, "image_sum": { - "enabled": true, + "enabled": false, "service": "openai", "group": true, "qa_prefix":"", @@ -40,9 +40,9 @@ "search1api_key": "", "gemini_key": "", "perplexity_key": "", - "open_ai_api_key": "sk-5dyg7PMUNeoSqHH807453eB06f434c34Ba6fB4764aC8358c", - "model": "moonshot-v1-128k", - "open_ai_api_base": "http://106.15.182.218:3001/v1", + "open_ai_api_key": "sk-j8d7FPYUoUZJsE7xCcA6A8B980334a09AbB5B00a70E078Bb", + "model": "7374349217580056592", + "open_ai_api_base": "http://148.135.83.192:3001/v1", "xunfei_app_id": "", "xunfei_api_key": "", "xunfei_api_secret": "", diff --git a/plugins/sum4all/sum4all.py b/plugins/sum4all/sum4all.py index 5e5ee2c..4b49623 100644 --- a/plugins/sum4all/sum4all.py +++ b/plugins/sum4all/sum4all.py @@ -630,11 +630,12 @@ class sum4all(Plugin): "model": model, "messages": [ {"role": "system", "content": prompt}, - {"role": "user", "content": content} + {"role": "user", "content": f'Use the following context as your learned knowledge, inside XML tags.\n\t{content}\n\t\n\tWhen answer to user:\n\t- If you don\'t know, just say that you don\'t know.\n\t- If you don\'t know when you are not sure, ask for clarification.\n\tAvoid mentioning that you obtained the information from the context.\n\tAnd answer according to the language of the user\'s question.\n\t\t\t\n\tGiven the context information, answer the query.'} ] } api_url = f"{api_base}/chat/completions" try: + logger.info(f'handle_file 文件请求内容: {json.dumps(data)}') response = requests.post(api_url, headers=headers, data=json.dumps(data)) response.raise_for_status() response_data = response.json() @@ -685,7 +686,8 @@ class sum4all(Plugin): logger.info(f"开始读取PDF文件:{file_path}") doc = fitz.open(file_path) content = ' '.join([page.get_text() for page in doc]) - logger.info(f"PDF文件读取完成:{file_path}") + # logger.info(f"PDF文件读取完成:{file_path}") + logger.info(f"PDF文件读取完成:{file_path},内容:{content}") return content def read_word(self, file_path):