Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -181,30 +181,18 @@ SYSTEM_PROMPT = (
|
|
181 |
# === GRADIO UI ===
|
182 |
with gr.Blocks() as demo:
|
183 |
chatbot = gr.Chatbot()
|
184 |
-
|
185 |
-
|
186 |
-
clear_btn = gr.Button("Neue Sitzung")
|
187 |
|
188 |
-
def respond(message,
|
189 |
try:
|
190 |
franz_engine = DrFranzEngine()
|
191 |
-
analysis = franz_engine.analyze_input(message,
|
192 |
reply = franz_engine.generate_response(analysis)
|
193 |
-
|
|
|
194 |
except Exception as e:
|
195 |
-
return [(message, "Technischer Fehler")]
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
inputs=[user_input, chatbot],
|
200 |
-
outputs=[chatbot]
|
201 |
-
)
|
202 |
-
user_input.submit(
|
203 |
-
respond,
|
204 |
-
inputs=[user_input, chatbot],
|
205 |
-
outputs=[chatbot]
|
206 |
-
)
|
207 |
-
clear_btn.click(
|
208 |
-
lambda: [],
|
209 |
-
outputs=[chatbot]
|
210 |
-
)
|
|
|
181 |
# === GRADIO UI ===
|
182 |
with gr.Blocks() as demo:
|
183 |
chatbot = gr.Chatbot()
|
184 |
+
msg = gr.Textbox()
|
185 |
+
clear = gr.Button("Clear")
|
|
|
186 |
|
187 |
+
def respond(message, chat_history):
|
188 |
try:
|
189 |
franz_engine = DrFranzEngine()
|
190 |
+
analysis = franz_engine.analyze_input(message, chat_history)
|
191 |
reply = franz_engine.generate_response(analysis)
|
192 |
+
chat_history.append((message, reply))
|
193 |
+
return "", chat_history
|
194 |
except Exception as e:
|
195 |
+
return "", chat_history + [(message, "Technischer Fehler")]
|
196 |
|
197 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
198 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|