Spaces:
Paused
Paused
Upload app.py
Browse files
app.py
CHANGED
|
@@ -210,7 +210,8 @@ def respond(message, chat_history):
|
|
| 210 |
|
| 211 |
if not vector_db:
|
| 212 |
bot_message = "π Welcome! Please provide a repo link or upload your code files using the panel on the left to start chatting."
|
| 213 |
-
chat_history.append(
|
|
|
|
| 214 |
return "", chat_history
|
| 215 |
|
| 216 |
try:
|
|
@@ -229,10 +230,12 @@ def respond(message, chat_history):
|
|
| 229 |
final_answer += f"```python\n{doc.page_content}\n```\n\n"
|
| 230 |
final_answer += "</details>"
|
| 231 |
|
| 232 |
-
chat_history.append(
|
|
|
|
| 233 |
except Exception as e:
|
| 234 |
bot_message = f"β An error occurred during processing: {str(e)}"
|
| 235 |
-
chat_history.append(
|
|
|
|
| 236 |
|
| 237 |
return "", chat_history
|
| 238 |
|
|
@@ -278,7 +281,7 @@ with gr.Blocks(title="Codebase Assistant") as demo:
|
|
| 278 |
|
| 279 |
with gr.Column(scale=3):
|
| 280 |
gr.Markdown("### π» Chat Interface\nAsk architecture questions, find bugs, or request code explanations. I will **only** answer questions related to code.")
|
| 281 |
-
chatbot = gr.Chatbot(height=600, show_label=False)
|
| 282 |
|
| 283 |
with gr.Row():
|
| 284 |
msg = gr.Textbox(placeholder="E.g., What does the main function do? (Press Enter to send)", show_label=False, scale=4)
|
|
|
|
| 210 |
|
| 211 |
if not vector_db:
|
| 212 |
bot_message = "π Welcome! Please provide a repo link or upload your code files using the panel on the left to start chatting."
|
| 213 |
+
chat_history.append({"role": "user", "content": message})
|
| 214 |
+
chat_history.append({"role": "assistant", "content": bot_message})
|
| 215 |
return "", chat_history
|
| 216 |
|
| 217 |
try:
|
|
|
|
| 230 |
final_answer += f"```python\n{doc.page_content}\n```\n\n"
|
| 231 |
final_answer += "</details>"
|
| 232 |
|
| 233 |
+
chat_history.append({"role": "user", "content": message})
|
| 234 |
+
chat_history.append({"role": "assistant", "content": final_answer})
|
| 235 |
except Exception as e:
|
| 236 |
bot_message = f"β An error occurred during processing: {str(e)}"
|
| 237 |
+
chat_history.append({"role": "user", "content": message})
|
| 238 |
+
chat_history.append({"role": "assistant", "content": bot_message})
|
| 239 |
|
| 240 |
return "", chat_history
|
| 241 |
|
|
|
|
| 281 |
|
| 282 |
with gr.Column(scale=3):
|
| 283 |
gr.Markdown("### π» Chat Interface\nAsk architecture questions, find bugs, or request code explanations. I will **only** answer questions related to code.")
|
| 284 |
+
chatbot = gr.Chatbot(height=600, show_label=False, type="messages")
|
| 285 |
|
| 286 |
with gr.Row():
|
| 287 |
msg = gr.Textbox(placeholder="E.g., What does the main function do? (Press Enter to send)", show_label=False, scale=4)
|