adikwok commited on
Commit
51d2e5a
·
verified ·
1 Parent(s): 3cd807f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -129,7 +129,7 @@ def manual_curl_example():
129
 
130
  curl_cmd = f'''curl -X POST "{API_URL}" \\
131
  -H "Authorization: Bearer {API_KEY}" \\
132
- -H "Content-Type: "application/json" \\
133
  -d '{{
134
  "model": "llama3-8b-8192",
135
  "messages": [
@@ -144,17 +144,20 @@ def manual_curl_example():
144
  with gr.Blocks(title="Grok Debug with Memory", css="""
145
  .chatbot-container { max-height: 500px; overflow-y: auto; }
146
  .input-container { position: sticky; bottom: 0; background: white; padding: 10px; }
 
 
147
  """) as demo:
148
  gr.Markdown("# 🔍 Groq API Debug Tool with Memory")
149
 
150
  with gr.Tab("Chat with Memory"):
151
- gr.Markdown("Chat with Grok, maintain history, and summarize by topic")
152
 
153
  chatbot = gr.Chatbot(
154
  label="Conversation",
155
  container=True,
156
  height=500,
157
- elem_classes="chatbot-container"
 
158
  )
159
  with gr.Row(elem_classes="input-container"):
160
  chat_input = gr.Textbox(
@@ -181,8 +184,7 @@ with gr.Blocks(title="Grok Debug with Memory", css="""
181
  chat_button.click(
182
  groq_with_memory,
183
  inputs=[chat_input, topic_input, summarize_checkbox],
184
- outputs=[chatbot],
185
- _js="() => { setTimeout(() => document.querySelector('.chatbot-container').scrollTop = document.querySelector('.chatbot-container').scrollHeight, 100); }"
186
  ).then(
187
  update_chatbot_display,
188
  outputs=[chatbot]
 
129
 
130
  curl_cmd = f'''curl -X POST "{API_URL}" \\
131
  -H "Authorization: Bearer {API_KEY}" \\
132
+ -H "Content-Type: application/json" \\
133
  -d '{{
134
  "model": "llama3-8b-8192",
135
  "messages": [
 
144
  with gr.Blocks(title="Grok Debug with Memory", css="""
145
  .chatbot-container { max-height: 500px; overflow-y: auto; }
146
  .input-container { position: sticky; bottom: 0; background: white; padding: 10px; }
147
+ .chatbot .message.user { text-align: left; background: #e6f3ff; padding: 10px; border-radius: 10px; margin: 5px; }
148
+ .chatbot .message.assistant { text-align: right; background: #f0f0f0; padding: 10px; border-radius: 10px; margin: 5px; }
149
  """) as demo:
150
  gr.Markdown("# 🔍 Groq API Debug Tool with Memory")
151
 
152
  with gr.Tab("Chat with Memory"):
153
+ gr.Markdown("Chat with Groq, maintain history, and summarize by topic")
154
 
155
  chatbot = gr.Chatbot(
156
  label="Conversation",
157
  container=True,
158
  height=500,
159
+ elem_classes="chatbot-container",
160
+ bubble_full_width=False
161
  )
162
  with gr.Row(elem_classes="input-container"):
163
  chat_input = gr.Textbox(
 
184
  chat_button.click(
185
  groq_with_memory,
186
  inputs=[chat_input, topic_input, summarize_checkbox],
187
+ outputs=[chatbot]
 
188
  ).then(
189
  update_chatbot_display,
190
  outputs=[chatbot]