Parcourir la source

修改文件分析prompt

develop
H Vs il y a 2 mois
Parent
révision
3342be4f5b
2 fichiers modifiés avec 9 ajouts et 7 suppressions
  1. +5
    -5
      plugins/sum4all/config.json
  2. +4
    -2
      plugins/sum4all/sum4all.py

+ 5
- 5
plugins/sum4all/config.json Voir le fichier

@@ -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": "",


+ 4
- 2
plugins/sum4all/sum4all.py Voir le fichier

@@ -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 <context></context> XML tags.\n\t<context>{content}</context>\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):


Chargement…
Annuler
Enregistrer