|
@@ -49,7 +49,13 @@ def question_fission(query):
|
|
|
"""
|
|
|
# print(prompt)
|
|
|
question_dict = kimi_ai(prompt=prompt)
|
|
|
- return json.loads(question_dict.replace("'", '"'))
|
|
|
+ print(question_dict)
|
|
|
+ print(type(question_dict))
|
|
|
+ try:
|
|
|
+ res = json.loads(question_dict.replace("'", '"'))
|
|
|
+ except:
|
|
|
+ res = json.loads(question_dict)
|
|
|
+ return res
|
|
|
|
|
|
|
|
|
# 第二步搜索内容
|
|
@@ -73,7 +79,7 @@ def generate_text(question):
|
|
|
通过给到你的这个问题:'{question}',
|
|
|
生成一篇小文章,文章需要有逻辑,有参考意义
|
|
|
"""
|
|
|
- text = tencent_ai(prompt)
|
|
|
+ text = kimi_ai(prompt)
|
|
|
return text
|
|
|
|
|
|
|
|
@@ -85,7 +91,11 @@ def summary_articles(materials):
|
|
|
:return:
|
|
|
"""
|
|
|
img_list = []
|
|
|
- materials = json.loads(materials)
|
|
|
+ materials_ = json.loads(materials.replace("\n", "").replace("#", ""))
|
|
|
+ keys = []
|
|
|
+ for key in materials_:
|
|
|
+ keys.append(key)
|
|
|
+
|
|
|
prompt = f"""
|
|
|
# Role:信息萃取师
|
|
|
- 介绍:作为信息萃取师,我拥有从海量信息源中进行细致分析的能力,能找出最核心的信息点,并对其真实性进行评估。我对复杂问题的处理方式是逻辑思考者的方式,依据事实证据而非容易出错的直觉来形成结论。此外,我擅长以专业的写作技巧,有条理地组织思想和观点,确保所写内容引人入胜,并且绝不枯燥。
|
|
@@ -103,15 +113,22 @@ def summary_articles(materials):
|
|
|
- 操作指南:根据用户的问题,使用中文编写清晰、简洁且准确的回答。
|
|
|
- 限制要求:不要忽略问题的任何细节,从给定的参考资料中引述的信息需要经过论证并且不能照搬原话。
|
|
|
- 工作流程:
|
|
|
- 1. 根据给定的参考资料(以数字索引表示)进行阅读和分析:{materials[0]['raw_content']}、{materials[1]['raw_content']}、{materials[2]['raw_content']}、{materials[3]['raw_content']}、{materials[4]['raw_content']}
|
|
|
+ 1. 根据给定的参考资料(以数字索引表示)进行阅读和分析:
|
|
|
+ 材料1 标题: '{keys[0]}', 材料: '{materials_[keys[0]]}' ,
|
|
|
+ 材料1 标题: '{keys[1]}', 材料: '{materials_[keys[1]]}' ,
|
|
|
+ 材料1 标题: '{keys[2]}', 材料: '{materials_[keys[2]]}' ,
|
|
|
+ 材料1 标题: '{keys[3]}', 材料: '{materials_[keys[3]]}' ,
|
|
|
+ 材料1 标题: '{keys[4]}', 材料: '{materials_[keys[4]]}'
|
|
|
2. 创作回答:依照专业的写作技巧,使用汉语有条理地组织思想,写出高质量的文章
|
|
|
|
|
|
## OutputFormat:
|
|
|
- 返回json格式,如下
|
|
|
- {
|
|
|
+ 返回json格式,key, value如下
|
|
|
"title": 总结上述材料的标题,
|
|
|
- "text": 编写的文章
|
|
|
- }
|
|
|
+ "text": 编写的文章
|
|
|
"""
|
|
|
response = kimi_ai(prompt=prompt)
|
|
|
+ try:
|
|
|
+ response = json.loads(response.replace("\n", ""))
|
|
|
+ except:
|
|
|
+ response = json.loads(response.replace("'", '"'))
|
|
|
return img_list, response['title'], response['text']
|