SarahXia0405 commited on
Commit
fd7a63e
·
verified ·
1 Parent(s): 89f9fdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -210,6 +210,20 @@ with gr.Blocks(title="Clare – Hanbridge AI Teaching Assistant") as demo:
210
  rag_context=rag_context,
211
  )
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  status_text = render_session_status(learning_mode_val, weaknesses, cognitive_state)
214
  return "", new_history, weaknesses, cognitive_state, status_text
215
 
 
210
  rag_context=rag_context,
211
  )
212
 
213
+ # RAG 标记
214
+ if rag_context:
215
+ # 根据语言给不同提示
216
+ if resolved_lang == "中文":
217
+ prefix = "(本次回答参考了你上传的课程文档内容。)\n\n"
218
+ else:
219
+ prefix = "(This answer used excerpts from your uploaded course document.)\n\n"
220
+
221
+ tagged_answer = prefix + answer
222
+ # 更新最后一条记录里的 assistant 内容
223
+ if new_history:
224
+ new_history[-1] = (message, tagged_answer)
225
+ answer = tagged_answer
226
+
227
  status_text = render_session_status(learning_mode_val, weaknesses, cognitive_state)
228
  return "", new_history, weaknesses, cognitive_state, status_text
229