Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import os
|
|
6 |
API_URL = "https://host.palple.polrambora.com/pmsq"
|
7 |
|
8 |
sessions = {}
|
9 |
-
|
10 |
ASSISTANT_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/resolve/main/API.png"
|
11 |
USER_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/resolve/main/usr.png"
|
12 |
|
@@ -59,7 +59,7 @@ def respond(message, api_key, max_tokens, top_p, temperature):
|
|
59 |
session = sessions.get(api_key, {})
|
60 |
history = session.get("history", [])
|
61 |
headers = session.get("headers", {})
|
62 |
-
system_message = session.get("system_message",
|
63 |
messages = []
|
64 |
for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history:
|
65 |
if user_message:
|
@@ -186,7 +186,7 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
186 |
outputs=[chatbot_output, history_state])
|
187 |
|
188 |
def authorize_and_proceed(user, api_key):
|
189 |
-
if authorize(user, api_key):
|
190 |
messages_html, history = load_conversation(api_key)
|
191 |
return gr.update(visible=False), gr.update(visible=True), messages_html, history
|
192 |
else:
|
|
|
6 |
API_URL = "https://host.palple.polrambora.com/pmsq"
|
7 |
|
8 |
sessions = {}
|
9 |
+
PRIMARY_SYSTEM_INSTRUCTIONS = "You are P-MSQ (Messaging Service Query), a friendly AI Chatbot that can help in any situations"
|
10 |
ASSISTANT_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/resolve/main/API.png"
|
11 |
USER_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/resolve/main/usr.png"
|
12 |
|
|
|
59 |
session = sessions.get(api_key, {})
|
60 |
history = session.get("history", [])
|
61 |
headers = session.get("headers", {})
|
62 |
+
system_message = session.get("system_message", PRIMARY_SYSTEM_INSTRUCTIONS)
|
63 |
messages = []
|
64 |
for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history:
|
65 |
if user_message:
|
|
|
186 |
outputs=[chatbot_output, history_state])
|
187 |
|
188 |
def authorize_and_proceed(user, api_key):
|
189 |
+
if authorize(user, api_key, PRIMARY_SYSTEM_INSTRUCTIONS):
|
190 |
messages_html, history = load_conversation(api_key)
|
191 |
return gr.update(visible=False), gr.update(visible=True), messages_html, history
|
192 |
else:
|