Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,8 +162,18 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 162 |
last_message_state = gr.State("")
|
| 163 |
|
| 164 |
def user_interaction(message, history, api_key, max_tokens, top_p, temperature):
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
def regenerate_response(history, last_message, max_tokens, top_p, temperature):
|
| 169 |
return "", []
|
|
|
|
| 162 |
last_message_state = gr.State("")
|
| 163 |
|
| 164 |
def user_interaction(message, history, api_key, max_tokens, top_p, temperature):
|
| 165 |
+
history, assistant_reply = respond(message, api_key, max_tokens, top_p, temperature)
|
| 166 |
+
|
| 167 |
+
new_message_html = f"<div style='display: flex; align-items: center; margin-bottom: 10px;'>"
|
| 168 |
+
new_message_html += f"<img src='{USER_PIC_PATH}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>"
|
| 169 |
+
new_message_html += f"{message}</div><br>"
|
| 170 |
+
|
| 171 |
+
new_message_html += f"<div style='display: flex; align-items: center; margin-bottom: 10px;'>"
|
| 172 |
+
new_message_html += f"<img src='{ASSISTANT_PIC_PATH}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>"
|
| 173 |
+
new_message_html += f"{assistant_reply}</div><br>"
|
| 174 |
+
|
| 175 |
+
return gr.update(value=new_message_html, append=True), history, "", message
|
| 176 |
+
|
| 177 |
|
| 178 |
def regenerate_response(history, last_message, max_tokens, top_p, temperature):
|
| 179 |
return "", []
|