Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -46,16 +46,15 @@ class InferenceClient:
|
|
46 |
class MyChatbot(gr.Chatbot):
|
47 |
"""Custom Chatbot class for enhanced functionality."""
|
48 |
def __init__(self, **kwargs):
|
49 |
-
super().__init__(**kwargs)
|
50 |
-
self.issues = []
|
51 |
-
self.current_issue = None
|
52 |
|
53 |
def postprocess(self, y):
|
54 |
"""Post-processes the response to handle commands and display results."""
|
55 |
if not y:
|
56 |
return []
|
57 |
|
58 |
-
# Handle different types of input
|
59 |
if isinstance(y, dict):
|
60 |
assistant_response = y.get('assistant_response', '')
|
61 |
command = y.get('command', '')
|
@@ -63,7 +62,12 @@ class MyChatbot(gr.Chatbot):
|
|
63 |
assistant_response = str(y)
|
64 |
command = ''
|
65 |
|
66 |
-
return [
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
# Update the Blocks implementation
|
69 |
with gr.Blocks() as demo:
|
|
|
46 |
class MyChatbot(gr.Chatbot):
|
47 |
"""Custom Chatbot class for enhanced functionality."""
|
48 |
def __init__(self, **kwargs):
|
49 |
+
super().__init__(type="messages", **kwargs) # Set type to 'messages'
|
50 |
+
self.issues = []
|
51 |
+
self.current_issue = None
|
52 |
|
53 |
def postprocess(self, y):
|
54 |
"""Post-processes the response to handle commands and display results."""
|
55 |
if not y:
|
56 |
return []
|
57 |
|
|
|
58 |
if isinstance(y, dict):
|
59 |
assistant_response = y.get('assistant_response', '')
|
60 |
command = y.get('command', '')
|
|
|
62 |
assistant_response = str(y)
|
63 |
command = ''
|
64 |
|
65 |
+
return [
|
66 |
+
{
|
67 |
+
"role": "assistant",
|
68 |
+
"content": assistant_response
|
69 |
+
}
|
70 |
+
]
|
71 |
|
72 |
# Update the Blocks implementation
|
73 |
with gr.Blocks() as demo:
|