收口创作代理上传图标按钮

creation-agent composer 上传文档和参考图入口改用 PlatformIconButton

工作台测试断言上传入口接入公共图标按钮

补充 PlatformUiKit 收口文档和 Hermes 决策记录
This commit is contained in:
2026-06-10 12:56:18 +08:00
parent 3f7748983c
commit 2bc76f0558
4 changed files with 32 additions and 22 deletions

View File

@@ -75,10 +75,17 @@ test('creation agent workspace keeps initial chat progress at zero percent', ()
onBack={() => {}}
onSubmitText={() => {}}
onPrimaryAction={() => {}}
onReferenceImageChange={() => {}}
/>,
);
const progressbar = screen.getByRole('progressbar');
const documentUploadButton = screen.getByRole('button', {
name: '上传文档',
});
const referenceUploadButton = screen.getByRole('button', {
name: '上传参考图',
});
expect(progressbar.getAttribute('aria-valuenow')).toBe('0');
expect(progressbar.getAttribute('aria-labelledby')).toBe(
@@ -90,6 +97,8 @@ test('creation agent workspace keeps initial chat progress at zero percent', ()
.getByTestId('creation-agent-message-list')
.closest('.platform-subpanel')?.className,
).toContain('rounded-[1.5rem]');
expect(documentUploadButton.className).toContain('platform-icon-button');
expect(referenceUploadButton.className).toContain('platform-icon-button');
expect(
(progressbar.firstElementChild as HTMLElement | null)?.style.width,
).toBe('0%');

View File

@@ -9,6 +9,7 @@ import {
resolveCreationAgentProgressHint,
} from '../../services/creation-agent';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformIconButton } from '../common/PlatformIconButton';
import { PlatformProgressBar } from '../common/PlatformProgressBar';
import { PlatformStatusMessage } from '../common/PlatformStatusMessage';
import { PlatformSubpanel } from '../common/PlatformSubpanel';
@@ -639,25 +640,22 @@ export function CreationAgentWorkspace({
onChange={handleReferenceImageInputChange}
/>
) : null}
<button
type="button"
aria-label={
isParsingDocumentInput ? '正在解析文档' : '上传文档'
}
<PlatformIconButton
label={isParsingDocumentInput ? '正在解析文档' : '上传文档'}
title={isParsingDocumentInput ? '正在解析文档' : '上传文档'}
aria-busy={isParsingDocumentInput}
disabled={isBusy || isParsingDocumentInput}
onClick={openDocumentInputPicker}
className="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-[var(--platform-text-base)] hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40"
>
<Paperclip
className={`h-4 w-4 ${isParsingDocumentInput ? 'animate-pulse' : ''}`}
/>
</button>
icon={
<Paperclip
className={`h-4 w-4 ${isParsingDocumentInput ? 'animate-pulse' : ''}`}
/>
}
className="h-11 w-11 shrink-0"
/>
{onReferenceImageChange ? (
<button
type="button"
aria-label={
<PlatformIconButton
label={
isReadingReferenceImage ? '正在读取参考图' : '上传参考图'
}
title={
@@ -666,12 +664,13 @@ export function CreationAgentWorkspace({
aria-busy={isReadingReferenceImage}
disabled={isBusy || isReadingReferenceImage}
onClick={openReferenceImagePicker}
className="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-[var(--platform-text-base)] hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40"
>
<ImagePlus
className={`h-4 w-4 ${isReadingReferenceImage ? 'animate-pulse' : ''}`}
/>
</button>
icon={
<ImagePlus
className={`h-4 w-4 ${isReadingReferenceImage ? 'animate-pulse' : ''}`}
/>
}
className="h-11 w-11 shrink-0"
/>
) : null}
<textarea
value={draftText}