Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -94,13 +94,15 @@ def respond(message, api_key, max_tokens, top_p, temperature):
|
|
| 94 |
response_json = response.json()
|
| 95 |
assistant_reply = response_json["msq"]["message"][0]
|
| 96 |
|
|
|
|
| 97 |
history.append((message, assistant_reply, "You", "P-ALPLE", USER_PIC_PATH, ASSISTANT_PIC_PATH))
|
| 98 |
sessions[api_key]["history"] = history
|
| 99 |
|
| 100 |
-
return history, assistant_reply
|
| 101 |
else:
|
| 102 |
return history, "Error: " + response.json().get("error", "Unknown error occurred.")
|
| 103 |
|
|
|
|
| 104 |
def render_message(history):
|
| 105 |
messages_html = """
|
| 106 |
<div id="chatbox-container" class="chatbox">
|
|
@@ -163,7 +165,6 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 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 |
-
history.append((message, assistant_reply, "You", "P-ALPLE", USER_PIC_PATH, ASSISTANT_PIC_PATH))
|
| 167 |
full_history_html = render_message(history)
|
| 168 |
return full_history_html, history, "", message
|
| 169 |
|
|
|
|
| 94 |
response_json = response.json()
|
| 95 |
assistant_reply = response_json["msq"]["message"][0]
|
| 96 |
|
| 97 |
+
|
| 98 |
history.append((message, assistant_reply, "You", "P-ALPLE", USER_PIC_PATH, ASSISTANT_PIC_PATH))
|
| 99 |
sessions[api_key]["history"] = history
|
| 100 |
|
| 101 |
+
return history, assistant_reply
|
| 102 |
else:
|
| 103 |
return history, "Error: " + response.json().get("error", "Unknown error occurred.")
|
| 104 |
|
| 105 |
+
|
| 106 |
def render_message(history):
|
| 107 |
messages_html = """
|
| 108 |
<div id="chatbox-container" class="chatbox">
|
|
|
|
| 165 |
|
| 166 |
def user_interaction(message, history, api_key, max_tokens, top_p, temperature):
|
| 167 |
history, assistant_reply = respond(message, api_key, max_tokens, top_p, temperature)
|
|
|
|
| 168 |
full_history_html = render_message(history)
|
| 169 |
return full_history_html, history, "", message
|
| 170 |
|