Rooni commited on
Commit
538666e
·
1 Parent(s): 6e80ea9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -36,12 +36,19 @@ def update_chat(input_text):
36
  assistant_reply = generate_response(chat_history)
37
  assistant_message = {'role': 'assistant', 'content': assistant_reply}
38
  chat_history.append(assistant_message)
 
 
 
 
 
 
 
39
 
40
  # Интерфейс Gradio для чата
41
  iface = gr.Interface(
42
  fn=update_chat,
43
  inputs=gr.Textbox(),
44
- outputs=gr.Textbox(text="Chat History:\n", type="readonly"),
45
  live=True,
46
  title="Chat with GPT-3.5-turbo"
47
  )
 
36
  assistant_reply = generate_response(chat_history)
37
  assistant_message = {'role': 'assistant', 'content': assistant_reply}
38
  chat_history.append(assistant_message)
39
+
40
+ # Обновление текста в поле вывода
41
+ output_text = "Chat History:\n"
42
+ for message in chat_history:
43
+ output_text += f"{message['role']}: {message['content']}\n"
44
+
45
+ return output_text
46
 
47
  # Интерфейс Gradio для чата
48
  iface = gr.Interface(
49
  fn=update_chat,
50
  inputs=gr.Textbox(),
51
+ outputs=gr.Textbox(type="readonly"),
52
  live=True,
53
  title="Chat with GPT-3.5-turbo"
54
  )