Spaces:
Runtime error
Runtime error
Commit
·
1fb03e3
1
Parent(s):
9cf5888
Updated
Browse files- __pycache__/llm.cpython-311.pyc +0 -0
- __pycache__/main.cpython-311.pyc +0 -0
- __pycache__/rag.cpython-311.pyc +0 -0
- frontend/src/App.jsx +14 -14
__pycache__/llm.cpython-311.pyc
ADDED
|
Binary file (2.94 kB). View file
|
|
|
__pycache__/main.cpython-311.pyc
ADDED
|
Binary file (3.98 kB). View file
|
|
|
__pycache__/rag.cpython-311.pyc
ADDED
|
Binary file (4.1 kB). View file
|
|
|
frontend/src/App.jsx
CHANGED
|
@@ -34,7 +34,7 @@ const App = () => {
|
|
| 34 |
const response = await fetch('/chat', {
|
| 35 |
method: 'POST',
|
| 36 |
headers: { 'Content-Type': 'application/json' },
|
| 37 |
-
body:
|
| 38 |
message: input,
|
| 39 |
session_id: sessionId
|
| 40 |
})
|
|
@@ -59,7 +59,7 @@ const App = () => {
|
|
| 59 |
for (const line of lines) {
|
| 60 |
if (line.startsWith('data: ')) {
|
| 61 |
const dataStr = line.replace('data: ', '').trim();
|
| 62 |
-
|
| 63 |
if (dataStr === '[DONE]') {
|
| 64 |
setIsLoading(false);
|
| 65 |
continue;
|
|
@@ -67,7 +67,7 @@ const App = () => {
|
|
| 67 |
|
| 68 |
try {
|
| 69 |
const data = JSON.parse(dataStr);
|
| 70 |
-
|
| 71 |
if (data.session_id && !sessionId) {
|
| 72 |
setSessionId(data.session_id);
|
| 73 |
localStorage.setItem('uba_session_id', data.session_id);
|
|
@@ -75,7 +75,7 @@ const App = () => {
|
|
| 75 |
|
| 76 |
if (data.content) {
|
| 77 |
assistantContent += data.content;
|
| 78 |
-
setMessages(prev => prev.map(msg =>
|
| 79 |
msg.id === assistantMsgId ? { ...msg, content: assistantContent } : msg
|
| 80 |
));
|
| 81 |
}
|
|
@@ -87,10 +87,10 @@ const App = () => {
|
|
| 87 |
}
|
| 88 |
} catch (error) {
|
| 89 |
console.error('Chat error:', error);
|
| 90 |
-
setMessages(prev => [...prev, {
|
| 91 |
-
role: 'assistant',
|
| 92 |
-
content: "I'm sorry, I'm experiencing some technical difficulties. Please try again later.",
|
| 93 |
-
id: Date.now() + 2
|
| 94 |
}]);
|
| 95 |
setIsLoading(false);
|
| 96 |
}
|
|
@@ -120,12 +120,12 @@ const App = () => {
|
|
| 120 |
))}
|
| 121 |
{isLoading && (
|
| 122 |
<div className="message assistant">
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
</div>
|
| 130 |
)}
|
| 131 |
</div>
|
|
|
|
| 34 |
const response = await fetch('/chat', {
|
| 35 |
method: 'POST',
|
| 36 |
headers: { 'Content-Type': 'application/json' },
|
| 37 |
+
body: JSON.stringify({
|
| 38 |
message: input,
|
| 39 |
session_id: sessionId
|
| 40 |
})
|
|
|
|
| 59 |
for (const line of lines) {
|
| 60 |
if (line.startsWith('data: ')) {
|
| 61 |
const dataStr = line.replace('data: ', '').trim();
|
| 62 |
+
|
| 63 |
if (dataStr === '[DONE]') {
|
| 64 |
setIsLoading(false);
|
| 65 |
continue;
|
|
|
|
| 67 |
|
| 68 |
try {
|
| 69 |
const data = JSON.parse(dataStr);
|
| 70 |
+
|
| 71 |
if (data.session_id && !sessionId) {
|
| 72 |
setSessionId(data.session_id);
|
| 73 |
localStorage.setItem('uba_session_id', data.session_id);
|
|
|
|
| 75 |
|
| 76 |
if (data.content) {
|
| 77 |
assistantContent += data.content;
|
| 78 |
+
setMessages(prev => prev.map(msg =>
|
| 79 |
msg.id === assistantMsgId ? { ...msg, content: assistantContent } : msg
|
| 80 |
));
|
| 81 |
}
|
|
|
|
| 87 |
}
|
| 88 |
} catch (error) {
|
| 89 |
console.error('Chat error:', error);
|
| 90 |
+
setMessages(prev => [...prev, {
|
| 91 |
+
role: 'assistant',
|
| 92 |
+
content: "I'm sorry, I'm experiencing some technical difficulties. Please try again later.",
|
| 93 |
+
id: Date.now() + 2
|
| 94 |
}]);
|
| 95 |
setIsLoading(false);
|
| 96 |
}
|
|
|
|
| 120 |
))}
|
| 121 |
{isLoading && (
|
| 122 |
<div className="message assistant">
|
| 123 |
+
<div className="message-sender">UBA Support</div>
|
| 124 |
+
<div className="typing-indicator">
|
| 125 |
+
<div className="dot"></div>
|
| 126 |
+
<div className="dot"></div>
|
| 127 |
+
<div className="dot"></div>
|
| 128 |
+
</div>
|
| 129 |
</div>
|
| 130 |
)}
|
| 131 |
</div>
|