'commit'
This commit is contained in:
@@ -39,7 +39,7 @@ async def chat(request: fastapi.Request):
|
||||
user_id = data.get('user_id', 'anonymous')
|
||||
query = data.get('query', '')
|
||||
type_id = data.get('type_id', '1') # 1-教学模式,2-对话模式
|
||||
yunxiao_sample = data.get('yunxiao_sample', False) # 是不是给长春云校做例子
|
||||
topic = data.get('topic', False)
|
||||
session_id = data.get('session_id', str(uuid.uuid4())) # 获取或生成会话ID
|
||||
include_history = data.get('include_history', True)
|
||||
|
||||
@@ -99,9 +99,12 @@ async def chat(request: fastapi.Request):
|
||||
for i, (user_msg, ai_msg) in enumerate(recent_history, 1):
|
||||
history_context += f"[对话 {i}] 用户: {user_msg}\n"
|
||||
history_context += f"[对话 {i}] 老师: {ai_msg}\n"
|
||||
if yunxiao_sample:
|
||||
if topic=='Math':
|
||||
with open(r"D:\dsWork\dsProject\dsLightRag\static\YunXiao.txt", "r", encoding="utf-8") as f:
|
||||
history_context += f"[讨论的内容] " + f.read() + "\n"
|
||||
if topic=='Physics':
|
||||
with open(r"D:\dsWork\dsProject\dsLightRag\static\WanYouYinLi.txt", "r", encoding="utf-8") as f:
|
||||
history_context += f"[讨论的内容] " + f.read() + "\n"
|
||||
|
||||
# 4. 构建学生信息上下文
|
||||
student_context = ""
|
||||
|
Reference in New Issue
Block a user