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

Replace TDesign's brand-pink badge with the same secondary-container
count used by settings lists so the download control matches the
surrounding ghost icon buttons.
main
wizardchen 2026-08-25 17:47:18 +08:00 committed by lyingbug
parent 94a2faf391
commit 6b916e7f88
4 changed files with 49 additions and 18 deletions

View File

@ -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;

View File

@ -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
};

View File

@ -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"/)

View File

@ -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">