Omar ID EL MOUMEN
commited on
Commit
·
d59b539
1
Parent(s):
c61d3cd
Fix chat not responding
Browse files
app.py
CHANGED
@@ -169,7 +169,7 @@ def create_interface():
|
|
169 |
with gr.Row(visible=False) as chat_row:
|
170 |
with gr.Column(scale=0.6):
|
171 |
chatbot = gr.Chatbot(height=600)
|
172 |
-
input_box = gr.Textbox(placeholder="Type message...")
|
173 |
submit_btn = gr.Button("Send", variant="primary")
|
174 |
|
175 |
with gr.Column(scale=0.4):
|
@@ -178,7 +178,6 @@ def create_interface():
|
|
178 |
interactive=True,
|
179 |
visible=False
|
180 |
)
|
181 |
-
|
182 |
available_tools = gr.Textbox(
|
183 |
label="Tools Available",
|
184 |
interactive=False,
|
@@ -223,14 +222,15 @@ def create_interface():
|
|
223 |
connect_btn.click(
|
224 |
connect_client,
|
225 |
inputs=api_key_input,
|
226 |
-
outputs=[connection_status, chat_row, model_selector, connect_btn, api_key_input
|
227 |
)
|
228 |
|
229 |
# Chat Handling
|
230 |
async def chat_stream(query, history, selected_model):
|
|
|
231 |
client.current_model = selected_model
|
232 |
|
233 |
-
# Initialize fresh client session
|
234 |
if not client.session:
|
235 |
await client.connect()
|
236 |
|
@@ -258,4 +258,8 @@ def create_interface():
|
|
258 |
|
259 |
if __name__ == "__main__":
|
260 |
interface = create_interface()
|
261 |
-
interface.launch(
|
|
|
|
|
|
|
|
|
|
169 |
with gr.Row(visible=False) as chat_row:
|
170 |
with gr.Column(scale=0.6):
|
171 |
chatbot = gr.Chatbot(height=600)
|
172 |
+
input_box = gr.Textbox(placeholder="Type message...", lines=1)
|
173 |
submit_btn = gr.Button("Send", variant="primary")
|
174 |
|
175 |
with gr.Column(scale=0.4):
|
|
|
178 |
interactive=True,
|
179 |
visible=False
|
180 |
)
|
|
|
181 |
available_tools = gr.Textbox(
|
182 |
label="Tools Available",
|
183 |
interactive=False,
|
|
|
222 |
connect_btn.click(
|
223 |
connect_client,
|
224 |
inputs=api_key_input,
|
225 |
+
outputs=[connection_status, chat_row, model_selector, available_tools, connect_btn, api_key_input]
|
226 |
)
|
227 |
|
228 |
# Chat Handling
|
229 |
async def chat_stream(query, history, selected_model):
|
230 |
+
print(f"Received query: {query}") # Debugging log
|
231 |
client.current_model = selected_model
|
232 |
|
233 |
+
# Initialize fresh client session if not connected
|
234 |
if not client.session:
|
235 |
await client.connect()
|
236 |
|
|
|
258 |
|
259 |
if __name__ == "__main__":
|
260 |
interface = create_interface()
|
261 |
+
interface.queue().launch(
|
262 |
+
server_port=7860,
|
263 |
+
server_name="0.0.0.0",
|
264 |
+
show_error=True
|
265 |
+
)
|