AUST001 commited on
Commit
5003a8d
·
1 Parent(s): 47ec66f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -31,12 +31,17 @@ def greet(user_question, clear_history):
31
  ]
32
  return '清空成功', ''
33
  else:
34
- return '', get_assistant_response(user_question, context)
 
 
 
 
 
35
 
36
  demo = gr.Interface(
37
  fn=greet,
38
  inputs=[
39
- gr.Textbox(lines=21, label='请输入问题', placeholder='请输入您的问题'),
40
  gr.Checkbox(label='清空聊天记录', default=False)
41
  ],
42
  outputs=[
 
31
  ]
32
  return '清空成功', ''
33
  else:
34
+ get_assistant_response(user_question, context)
35
+ prompt = ""
36
+
37
+ for item in context[3:]:
38
+ prompt += item["role"] + ": " + item["content"] + "\n"
39
+ return '', prompt
40
 
41
  demo = gr.Interface(
42
  fn=greet,
43
  inputs=[
44
+ gr.Textbox(lines=22, label='请输入问题', placeholder='请输入您的问题'),
45
  gr.Checkbox(label='清空聊天记录', default=False)
46
  ],
47
  outputs=[