|
|
|
@ -51,8 +51,7 @@ async def rag(request: fastapi.Request):
|
|
|
|
|
|
|
|
|
|
if output_model == "txt":
|
|
|
|
|
user_prompt = "\n 1、不要输出参考资料 或者 References !"
|
|
|
|
|
# user_prompt = "\n 1、不要输出参考资料 或者 References !"
|
|
|
|
|
user_prompt = "\n 2、资料中提供化学反应方程式的,一定要严格按提供的Latex公式输出,绝对不允许对Latex公式进行修改 !"
|
|
|
|
|
user_prompt = user_prompt+ "\n 2、资料中提供化学反应方程式的,一定要严格按提供的Latex公式输出,绝对不允许对Latex公式进行修改 !"
|
|
|
|
|
user_prompt = user_prompt + "\n 3、如果资料中提供了图片的,一定要严格按照原文提供图片输出,绝对不能省略或不输出!"
|
|
|
|
|
# user_prompt = user_prompt + "\n 4、资料中提到的知识内容,需要判断是否与本次问题相关,不相关的绝对不要输出!"
|
|
|
|
|
user_prompt = user_prompt + "\n 4、根据资料回答问题,可以适当拓展一下内容进行回答!"
|
|
|
|
@ -99,9 +98,8 @@ async def rag(request: fastapi.Request):
|
|
|
|
|
|
|
|
|
|
# 使用PG库后,这个是没有用的,但目前的项目代码要求必传,就写一个吧。
|
|
|
|
|
WORKING_DIR = workspace
|
|
|
|
|
if os.path.exists(WORKING_DIR):
|
|
|
|
|
shutil.rmtree(WORKING_DIR)
|
|
|
|
|
os.makedirs(WORKING_DIR)
|
|
|
|
|
if not os.path.exists(WORKING_DIR):
|
|
|
|
|
os.makedirs(WORKING_DIR)
|
|
|
|
|
|
|
|
|
|
async def generate_response_stream(query: str):
|
|
|
|
|
try:
|
|
|
|
|