Spaces:
Sleeping
Sleeping
enhance ui for visual feedback
Browse files- web/src/App.css +54 -0
- web/src/App.tsx +43 -5
web/src/App.css
CHANGED
|
@@ -589,6 +589,60 @@ details.tool-call summary::-webkit-details-marker {
|
|
| 589 |
gap: 1rem;
|
| 590 |
}
|
| 591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
.tool-name {
|
| 593 |
color: #d4a574;
|
| 594 |
font-weight: 600;
|
|
|
|
| 589 |
gap: 1rem;
|
| 590 |
}
|
| 591 |
|
| 592 |
+
/* Tool execution status indicators */
|
| 593 |
+
.tool-status {
|
| 594 |
+
display: inline-flex;
|
| 595 |
+
align-items: center;
|
| 596 |
+
gap: 0.5rem;
|
| 597 |
+
font-size: 0.85em;
|
| 598 |
+
padding: 0.25rem 0.5rem;
|
| 599 |
+
border-radius: 4px;
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
.tool-status.generating {
|
| 603 |
+
background: rgba(59, 130, 246, 0.1);
|
| 604 |
+
color: #60a5fa;
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
.tool-status.executing {
|
| 608 |
+
background: rgba(168, 85, 247, 0.1);
|
| 609 |
+
color: #c084fc;
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
.tool-status .dot {
|
| 613 |
+
width: 6px;
|
| 614 |
+
height: 6px;
|
| 615 |
+
border-radius: 50%;
|
| 616 |
+
background: currentColor;
|
| 617 |
+
animation: dot-bounce 1.4s infinite ease-in-out;
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
.tool-status .dot:nth-child(1) {
|
| 621 |
+
animation-delay: 0ms;
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
.tool-status .dot:nth-child(2) {
|
| 625 |
+
animation-delay: 160ms;
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
.tool-status .dot:nth-child(3) {
|
| 629 |
+
animation-delay: 320ms;
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
@keyframes dot-bounce {
|
| 633 |
+
0%, 80%, 100% {
|
| 634 |
+
transform: translateY(0);
|
| 635 |
+
}
|
| 636 |
+
40% {
|
| 637 |
+
transform: translateY(-8px);
|
| 638 |
+
}
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
.tool-status .status-text {
|
| 642 |
+
font-weight: 500;
|
| 643 |
+
white-space: nowrap;
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
.tool-name {
|
| 647 |
color: #d4a574;
|
| 648 |
font-weight: 600;
|
web/src/App.tsx
CHANGED
|
@@ -211,6 +211,8 @@ interface ToolCall {
|
|
| 211 |
name: string;
|
| 212 |
input: string;
|
| 213 |
output: string;
|
|
|
|
|
|
|
| 214 |
}
|
| 215 |
|
| 216 |
interface User {
|
|
@@ -375,7 +377,8 @@ function App() {
|
|
| 375 |
)
|
| 376 |
);
|
| 377 |
} else if (event === 'tool_start') {
|
| 378 |
-
// Add tool call placeholder
|
|
|
|
| 379 |
setMessages((prev) =>
|
| 380 |
prev.map((msg) =>
|
| 381 |
msg.id === assistantId
|
|
@@ -387,6 +390,8 @@ function App() {
|
|
| 387 |
name: data.name,
|
| 388 |
input: data.input,
|
| 389 |
output: '',
|
|
|
|
|
|
|
| 390 |
},
|
| 391 |
],
|
| 392 |
}
|
|
@@ -394,10 +399,25 @@ function App() {
|
|
| 394 |
)
|
| 395 |
);
|
| 396 |
} else if (event === 'tool_executing') {
|
| 397 |
-
// Tool is now executing
|
| 398 |
-
setStatusMessage(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
} else if (event === 'tool_complete') {
|
| 400 |
// Update tool call with result
|
|
|
|
| 401 |
setMessages((prev) =>
|
| 402 |
prev.map((msg) =>
|
| 403 |
msg.id === assistantId
|
|
@@ -405,7 +425,7 @@ function App() {
|
|
| 405 |
...msg,
|
| 406 |
toolCalls: (msg.toolCalls || []).map((tc) =>
|
| 407 |
tc.name === data.name && !tc.output
|
| 408 |
-
? { ...tc, output: data.output }
|
| 409 |
: tc
|
| 410 |
),
|
| 411 |
}
|
|
@@ -591,7 +611,25 @@ function App() {
|
|
| 591 |
<details key={idx} className="tool-call">
|
| 592 |
<summary className="tool-call-header">
|
| 593 |
<span className="tool-name">{tool.name}</span>
|
| 594 |
-
{tool.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
</summary>
|
| 596 |
<div className="tool-call-content">
|
| 597 |
<details className="tool-section">
|
|
|
|
| 211 |
name: string;
|
| 212 |
input: string;
|
| 213 |
output: string;
|
| 214 |
+
isGenerating?: boolean; // AI is writing the code
|
| 215 |
+
isExecuting?: boolean; // Code is running in sandbox
|
| 216 |
}
|
| 217 |
|
| 218 |
interface User {
|
|
|
|
| 377 |
)
|
| 378 |
);
|
| 379 |
} else if (event === 'tool_start') {
|
| 380 |
+
// Add tool call placeholder with generating state
|
| 381 |
+
setStatusMessage(`Generating ${data.name} code...`);
|
| 382 |
setMessages((prev) =>
|
| 383 |
prev.map((msg) =>
|
| 384 |
msg.id === assistantId
|
|
|
|
| 390 |
name: data.name,
|
| 391 |
input: data.input,
|
| 392 |
output: '',
|
| 393 |
+
isGenerating: true,
|
| 394 |
+
isExecuting: false,
|
| 395 |
},
|
| 396 |
],
|
| 397 |
}
|
|
|
|
| 399 |
)
|
| 400 |
);
|
| 401 |
} else if (event === 'tool_executing') {
|
| 402 |
+
// Tool is now executing - update status
|
| 403 |
+
setStatusMessage(`Executing ${data.name}...`);
|
| 404 |
+
setMessages((prev) =>
|
| 405 |
+
prev.map((msg) =>
|
| 406 |
+
msg.id === assistantId
|
| 407 |
+
? {
|
| 408 |
+
...msg,
|
| 409 |
+
toolCalls: (msg.toolCalls || []).map((tc) =>
|
| 410 |
+
tc.name === data.name && !tc.output
|
| 411 |
+
? { ...tc, isGenerating: false, isExecuting: true }
|
| 412 |
+
: tc
|
| 413 |
+
),
|
| 414 |
+
}
|
| 415 |
+
: msg
|
| 416 |
+
)
|
| 417 |
+
);
|
| 418 |
} else if (event === 'tool_complete') {
|
| 419 |
// Update tool call with result
|
| 420 |
+
setStatusMessage('');
|
| 421 |
setMessages((prev) =>
|
| 422 |
prev.map((msg) =>
|
| 423 |
msg.id === assistantId
|
|
|
|
| 425 |
...msg,
|
| 426 |
toolCalls: (msg.toolCalls || []).map((tc) =>
|
| 427 |
tc.name === data.name && !tc.output
|
| 428 |
+
? { ...tc, output: data.output, isGenerating: false, isExecuting: false }
|
| 429 |
: tc
|
| 430 |
),
|
| 431 |
}
|
|
|
|
| 611 |
<details key={idx} className="tool-call">
|
| 612 |
<summary className="tool-call-header">
|
| 613 |
<span className="tool-name">{tool.name}</span>
|
| 614 |
+
{tool.isGenerating && (
|
| 615 |
+
<span className="tool-status generating">
|
| 616 |
+
<span className="dot"></span>
|
| 617 |
+
<span className="dot"></span>
|
| 618 |
+
<span className="dot"></span>
|
| 619 |
+
<span className="status-text">Generating code...</span>
|
| 620 |
+
</span>
|
| 621 |
+
)}
|
| 622 |
+
{tool.isExecuting && (
|
| 623 |
+
<span className="tool-status executing">
|
| 624 |
+
<span className="dot"></span>
|
| 625 |
+
<span className="dot"></span>
|
| 626 |
+
<span className="dot"></span>
|
| 627 |
+
<span className="status-text">Executing...</span>
|
| 628 |
+
</span>
|
| 629 |
+
)}
|
| 630 |
+
{tool.output && !tool.isGenerating && !tool.isExecuting && (
|
| 631 |
+
<span className="checkmark">✓</span>
|
| 632 |
+
)}
|
| 633 |
</summary>
|
| 634 |
<div className="tool-call-content">
|
| 635 |
<details className="tool-section">
|