Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

ui(chat): mute the generated-files count on the answer toolbar

wizardchen6b916e7f887f
diff --git a/frontend/src/components/css/chat-message-shared.less b/frontend/src/components/css/chat-message-shared.less
index 3430ce6dc..f0e560dd7 100644
--- a/frontend/src/components/css/chat-message-shared.less
+++ b/frontend/src/components/css/chat-message-shared.less
@@ -89,6 +89,35 @@
}
}
+/* Count sits on the download glyph like the settings list badges: muted
+ surface + secondary type, not TDesign's brand-pink t-badge. */
+.answer-toolbar__artifact {
+ position: relative;
+ display: inline-flex;
+ flex-shrink: 0;
+}
+
+.answer-toolbar__artifact-count {
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ z-index: 1;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
+ min-width: 14px;
+ height: 14px;
+ padding: 0 3px;
+ border-radius: 7px;
+ background: var(--td-bg-color-secondarycontainer);
+ color: var(--td-text-color-secondary);
+ font-size: 10px;
+ font-weight: 600;
+ line-height: 1;
+ pointer-events: none;
+}
+
.answer-toolbar__follow-up-loading {
display: inline-flex;
align-items: center;
diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.vue b/frontend/src/views/chat/components/AgentStreamDisplay.vue
index 2724a6fc2..7875c9f80 100644
--- a/frontend/src/views/chat/components/AgentStreamDisplay.vue
+++ b/frontend/src/views/chat/components/AgentStreamDisplay.vue
@@ -340,19 +340,14 @@
assistant message recorded any generated files. Agent
mode is the primary path for skills, so this is where
the button is most likely to appear. -->
- <t-badge
- v-if="hasArtifacts"
- :count="artifactCount"
- :offset="[-4, 4]"
- shape="round"
- size="small"
- >
+ <span v-if="hasArtifacts" class="answer-toolbar__artifact">
<t-button size="small" variant="outline" shape="round"
@click.stop="openArtifactDrawer"
:title="$t('agent.artifactDrawer.buttonTitle')">
<t-icon name="download" />
</t-button>
- </t-badge>
+ <span class="answer-toolbar__artifact-count" aria-hidden="true">{{ artifactCount }}</span>
+ </span>
<t-tooltip v-if="event.is_fallback" :content="$t('chat.fallbackHint')" placement="top">
<t-button size="small" variant="outline" shape="round" class="fallback-icon-btn">
<t-icon name="info-circle" />
@@ -560,6 +555,7 @@ import { unwrapFinalAnswerWrappers, thinkingEqualsAnswer } from '@/utils/finalAn
import { getAgentToolIconName } from '@/utils/agent-tool-icons';
import { getQueryText, getWikiPageText } from '@/utils/agent-tool-display';
import { previewShellCommand } from '@/utils/shellExecResult';
+import type { DisplayType } from '@/types/tool-results';
import { parseWikiToolReferences } from '@/utils/wikiToolReferences';
import {
buildManualMarkdown,
@@ -1045,8 +1041,8 @@ const formatToolResultContent = (value: unknown): string => {
const isMcpTool = (toolName?: string | null): boolean => String(toolName || '').startsWith('mcp_');
-const resolveToolDisplayType = (event: any): string | undefined => {
- if (event?.display_type) return event.display_type
+const resolveToolDisplayType = (event: any): DisplayType | undefined => {
+ if (event?.display_type) return event.display_type as DisplayType
if (event?.tool_name === 'shell_exec') return 'shell_exec'
return undefined
};
diff --git a/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs b/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs
index 9feb4e98e..a6adb75b6 100644
--- a/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs
+++ b/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs
@@ -23,6 +23,17 @@ test('agent actions reuse the fully-rendered answer state', () => {
assert.match(agentStream, /v-if="answerFullyRendered && event\.done/)
})
+test('artifact download uses a muted count overlay instead of t-badge', () => {
+ assert.match(botMessage, /class="answer-toolbar__artifact"/)
+ assert.match(agentStream, /class="answer-toolbar__artifact"/)
+ assert.match(botMessage, /class="answer-toolbar__artifact-count"/)
+ assert.match(agentStream, /class="answer-toolbar__artifact-count"/)
+ assert.match(sharedStyles, /answer-toolbar__artifact-count/)
+ assert.match(sharedStyles, /td-bg-color-secondarycontainer/)
+ assert.doesNotMatch(botMessage, /<t-badge/)
+ assert.doesNotMatch(agentStream, /<t-badge/)
+})
+
test('follow-up loading is shown compactly inside both answer toolbars', () => {
assert.match(chatView, /:follow-up-loading="Boolean\(session\.suggestionLoading/)
assert.match(botMessage, /class="answer-toolbar__follow-up-loading"/)
diff --git a/frontend/src/views/chat/components/botmsg.vue b/frontend/src/views/chat/components/botmsg.vue
index 048b44bd8..32c72e9cd 100644
--- a/frontend/src/views/chat/components/botmsg.vue
+++ b/frontend/src/views/chat/components/botmsg.vue
@@ -56,19 +56,14 @@
assistant message actually recorded any generated files.
Emptiness is the default: the button stays hidden for
conversational messages that never touched a skill. -->
- <t-badge
- v-if="hasArtifacts"
- :count="artifactCount"
- :offset="[-4, 4]"
- shape="round"
- size="small"
- >
+ <span v-if="hasArtifacts" class="answer-toolbar__artifact">
<t-button size="small" variant="outline" shape="round"
@click.stop="openArtifactDrawer"
:title="$t('agent.artifactDrawer.buttonTitle')">
<t-icon name="download" />
</t-button>
- </t-badge>
+ <span class="answer-toolbar__artifact-count" aria-hidden="true">{{ artifactCount }}</span>
+ </span>
<!-- Fallback 提示图标 -->
<t-tooltip v-if="session.is_fallback" :content="$t('chat.fallbackHint')" placement="top">
<t-button size="small" variant="outline" shape="round" class="fallback-icon-btn">