Spaces:
Runtime error
Runtime error
nananie143
commited on
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ Provides a chat interface to interact with the autonomous agent teams:
|
|
10 |
|
11 |
import gradio as gr
|
12 |
import asyncio
|
13 |
-
from typing import Dict, Any, List
|
14 |
import json
|
15 |
from datetime import datetime
|
16 |
import logging
|
@@ -113,12 +113,12 @@ class ChatInterface:
|
|
113 |
self,
|
114 |
message: str,
|
115 |
history: List[List[str]]
|
116 |
-
) -> str:
|
117 |
"""Process incoming chat message."""
|
118 |
try:
|
119 |
# Check network before processing
|
120 |
if not check_network():
|
121 |
-
return "Network connectivity issues detected. Some features may be limited."
|
122 |
|
123 |
# Analyze message intent
|
124 |
intent = await self._analyze_intent(message)
|
@@ -133,22 +133,13 @@ class ChatInterface:
|
|
133 |
response = await self._handle_general_chat(message)
|
134 |
|
135 |
# Update chat history
|
136 |
-
|
137 |
-
"role": "user",
|
138 |
-
"content": message,
|
139 |
-
"timestamp": datetime.now()
|
140 |
-
})
|
141 |
-
self.chat_history.append({
|
142 |
-
"role": "assistant",
|
143 |
-
"content": response,
|
144 |
-
"timestamp": datetime.now()
|
145 |
-
})
|
146 |
|
147 |
-
return response
|
148 |
|
149 |
except Exception as e:
|
150 |
logger.error(f"Error processing message: {str(e)}")
|
151 |
-
return f"Error processing message: {str(e)}"
|
152 |
|
153 |
async def _analyze_intent(self, message: str) -> Dict[str, Any]:
|
154 |
"""Analyze user message intent."""
|
@@ -381,10 +372,13 @@ class VentureUI:
|
|
381 |
),
|
382 |
gr.State([]) # For chat history
|
383 |
],
|
384 |
-
outputs=
|
385 |
-
|
386 |
-
|
387 |
-
|
|
|
|
|
|
|
388 |
title="Advanced Agentic System Chat Interface",
|
389 |
description="""
|
390 |
Chat with our autonomous agent teams:
|
|
|
10 |
|
11 |
import gradio as gr
|
12 |
import asyncio
|
13 |
+
from typing import Dict, Any, List, Tuple
|
14 |
import json
|
15 |
from datetime import datetime
|
16 |
import logging
|
|
|
113 |
self,
|
114 |
message: str,
|
115 |
history: List[List[str]]
|
116 |
+
) -> Tuple[str, List[List[str]]]:
|
117 |
"""Process incoming chat message."""
|
118 |
try:
|
119 |
# Check network before processing
|
120 |
if not check_network():
|
121 |
+
return "Network connectivity issues detected. Some features may be limited.", history
|
122 |
|
123 |
# Analyze message intent
|
124 |
intent = await self._analyze_intent(message)
|
|
|
133 |
response = await self._handle_general_chat(message)
|
134 |
|
135 |
# Update chat history
|
136 |
+
history.append([message, response])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
+
return response, history
|
139 |
|
140 |
except Exception as e:
|
141 |
logger.error(f"Error processing message: {str(e)}")
|
142 |
+
return f"Error processing message: {str(e)}", history
|
143 |
|
144 |
async def _analyze_intent(self, message: str) -> Dict[str, Any]:
|
145 |
"""Analyze user message intent."""
|
|
|
372 |
),
|
373 |
gr.State([]) # For chat history
|
374 |
],
|
375 |
+
outputs=[
|
376 |
+
gr.Textbox(
|
377 |
+
label="Response",
|
378 |
+
lines=10
|
379 |
+
),
|
380 |
+
gr.State([]) # Matching state output
|
381 |
+
],
|
382 |
title="Advanced Agentic System Chat Interface",
|
383 |
description="""
|
384 |
Chat with our autonomous agent teams:
|