Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,8 +81,8 @@ st.markdown("""
|
|
| 81 |
# --- Top Branding, Mini Logo ---
|
| 82 |
st.markdown("""
|
| 83 |
<div class="lor-brand-bar">
|
| 84 |
-
<img src="https://
|
| 85 |
-
<div style="font-size: 13px; color: #888;">Powered by
|
| 86 |
</div>
|
| 87 |
""", unsafe_allow_html=True)
|
| 88 |
|
|
@@ -138,9 +138,9 @@ def clear_chat_history():
|
|
| 138 |
|
| 139 |
def display_chat_history():
|
| 140 |
messages = db.collection("users").document(user_id).collection("messages").order_by("timestamp").stream()
|
| 141 |
-
assistant_icon_html = "<img src='https://
|
| 142 |
chat_msgs = []
|
| 143 |
-
for msg in list(messages)[::-1]:
|
| 144 |
data = msg.to_dict()
|
| 145 |
if data["role"] == "user":
|
| 146 |
chat_msgs.append(
|
|
@@ -148,7 +148,7 @@ def display_chat_history():
|
|
| 148 |
)
|
| 149 |
else:
|
| 150 |
chat_msgs.append(
|
| 151 |
-
f"<div class='stChatMessage' data-testid='stChatMessage-assistant'>{assistant_icon_html} <strong>
|
| 152 |
)
|
| 153 |
st.markdown('<div class="chat-history-wrapper">' + "".join(chat_msgs) + '</div>', unsafe_allow_html=True)
|
| 154 |
st.markdown('<div id="chat-top-anchor"></div>', unsafe_allow_html=True)
|
|
@@ -198,7 +198,6 @@ window.setTimeout(function(){
|
|
| 198 |
""", unsafe_allow_html=True)
|
| 199 |
|
| 200 |
if user_input:
|
| 201 |
-
# --- OpenAI Assistant Response ---
|
| 202 |
thread_id = get_or_create_thread_id()
|
| 203 |
client.beta.threads.messages.create(thread_id=thread_id, role="user", content=user_input)
|
| 204 |
save_message("user", user_input)
|
|
|
|
| 81 |
# --- Top Branding, Mini Logo ---
|
| 82 |
st.markdown("""
|
| 83 |
<div class="lor-brand-bar">
|
| 84 |
+
<img src="https://www.gameonmobile.co.za/images/GameON!-Mobile-Training-Button-logo-Medium.png" class="logo-mini" />
|
| 85 |
+
<div style="font-size: 13px; color: #888;">Powered by GameOn</div>
|
| 86 |
</div>
|
| 87 |
""", unsafe_allow_html=True)
|
| 88 |
|
|
|
|
| 138 |
|
| 139 |
def display_chat_history():
|
| 140 |
messages = db.collection("users").document(user_id).collection("messages").order_by("timestamp").stream()
|
| 141 |
+
assistant_icon_html = "<img src='https://github.com/AndrewLORTech/gameonwebaiassistant/blob/main/GameGuy.jpg' width='22' style='vertical-align:middle; border-radius:50%;'/>"
|
| 142 |
chat_msgs = []
|
| 143 |
+
for msg in list(messages)[::-1]:
|
| 144 |
data = msg.to_dict()
|
| 145 |
if data["role"] == "user":
|
| 146 |
chat_msgs.append(
|
|
|
|
| 148 |
)
|
| 149 |
else:
|
| 150 |
chat_msgs.append(
|
| 151 |
+
f"<div class='stChatMessage' data-testid='stChatMessage-assistant'>{assistant_icon_html} <strong>GameGuy:</strong> {data['content']}</div>"
|
| 152 |
)
|
| 153 |
st.markdown('<div class="chat-history-wrapper">' + "".join(chat_msgs) + '</div>', unsafe_allow_html=True)
|
| 154 |
st.markdown('<div id="chat-top-anchor"></div>', unsafe_allow_html=True)
|
|
|
|
| 198 |
""", unsafe_allow_html=True)
|
| 199 |
|
| 200 |
if user_input:
|
|
|
|
| 201 |
thread_id = get_or_create_thread_id()
|
| 202 |
client.beta.threads.messages.create(thread_id=thread_id, role="user", content=user_input)
|
| 203 |
save_message("user", user_input)
|