Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat: 优化studio对话的chatbox样式交互 (#5956)

leowldb9623030339a
diff --git a/web-studio/src/i18n/locales/en/activity.ts b/web-studio/src/i18n/locales/en/activity.ts
index a7ce0d136..fc8299435 100644
--- a/web-studio/src/i18n/locales/en/activity.ts
+++ b/web-studio/src/i18n/locales/en/activity.ts
@@ -30,6 +30,7 @@ const activity = {
placeholder: 'Type a message...',
emptyState: 'Select or create a session to start chatting.',
thinking: 'Thinking...',
+ generating: 'Generating',
reasoning: 'Reasoning',
iteration: 'Round {{count}}',
toolCall: 'Tool call',
diff --git a/web-studio/src/i18n/locales/zh-CN/activity.ts b/web-studio/src/i18n/locales/zh-CN/activity.ts
index 20c170a25..410837bd1 100644
--- a/web-studio/src/i18n/locales/zh-CN/activity.ts
+++ b/web-studio/src/i18n/locales/zh-CN/activity.ts
@@ -30,6 +30,7 @@ const activity = {
placeholder: '输入消息...',
emptyState: '选择或创建一个会话开始聊天。',
thinking: '思考中...',
+ generating: '生成中',
reasoning: '思考过程',
iteration: '第 {{count}} 轮',
toolCall: '工具调用',
diff --git a/web-studio/src/routes/sessions/-components/composer.tsx b/web-studio/src/routes/sessions/-components/composer.tsx
index 8e56c8257..6a25bb879 100644
--- a/web-studio/src/routes/sessions/-components/composer.tsx
+++ b/web-studio/src/routes/sessions/-components/composer.tsx
@@ -107,8 +107,8 @@ export function Composer({
onClick={onCancel}
className={cn(
'inline-flex size-8 items-center justify-center rounded-lg',
- 'bg-destructive text-destructive-foreground',
- 'transition-colors hover:bg-destructive/90',
+ 'bg-muted text-foreground',
+ 'transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
)}
>
<SquareIcon className="size-3.5" />
diff --git a/web-studio/src/routes/sessions/-components/message-list.test.tsx b/web-studio/src/routes/sessions/-components/message-list.test.tsx
index 7c59bf95a..55dff0210 100644
--- a/web-studio/src/routes/sessions/-components/message-list.test.tsx
+++ b/web-studio/src/routes/sessions/-components/message-list.test.tsx
@@ -12,6 +12,18 @@ vi.mock('react-i18next', () => ({
afterEach(cleanup)
+describe('MessageList streaming indicator', () => {
+ it('shows the generating dot only while streaming', () => {
+ const { rerender } = render(
+ <MessageList messages={[]} streaming={{ iteration: 1, parts: [] }} />,
+ )
+ expect(screen.getByRole('status', { name: 'chat.generating' })).toBeTruthy()
+
+ rerender(<MessageList messages={[]} />)
+ expect(screen.queryByRole('status', { name: 'chat.generating' })).toBeNull()
+ })
+})
+
const toolParts: MessagePart[] = [
{
type: 'tool',
diff --git a/web-studio/src/routes/sessions/-components/message-list.tsx b/web-studio/src/routes/sessions/-components/message-list.tsx
index 3b2b1a92d..79d8228f1 100644
--- a/web-studio/src/routes/sessions/-components/message-list.tsx
+++ b/web-studio/src/routes/sessions/-components/message-list.tsx
@@ -88,15 +88,21 @@ function formatRelativeTime(iso: string, t: TFunction<'sessions'>): string {
}
// ---------------------------------------------------------------------------
-// TypingIndicator
+// StreamingIndicator
// ---------------------------------------------------------------------------
-function TypingIndicator() {
+function StreamingIndicator() {
+ const { t } = useTranslation('sessions')
return (
- <div className="flex items-center gap-1 py-1">
- <span className="size-1.5 rounded-full bg-muted-foreground/40 animate-bounce [animation-delay:0ms]" />
- <span className="size-1.5 rounded-full bg-muted-foreground/40 animate-bounce [animation-delay:150ms]" />
- <span className="size-1.5 rounded-full bg-muted-foreground/40 animate-bounce [animation-delay:300ms]" />
+ <div
+ role="status"
+ aria-label={t('chat.generating')}
+ className="flex h-5 items-center"
+ >
+ <span
+ aria-hidden="true"
+ className="size-1.5 animate-pulse rounded-full bg-muted-foreground motion-reduce:animate-none"
+ />
</div>
)
}
@@ -327,7 +333,6 @@ function StreamingAssistantMessage({
onResourceClick?: (uri: string) => void
}) {
const safeParts = Array.isArray(parts) ? parts : []
- const hasContent = safeParts.length > 0
const toolResultsById = getToolResultsById(safeParts)
return (
@@ -340,7 +345,7 @@ function StreamingAssistantMessage({
renderStreamingPart(part, i, toolResultsById, onResourceClick),
)}
- {!hasContent ? <TypingIndicator /> : null}
+ <StreamingIndicator />
</div>
</div>
)