hide frontend image model names

This commit is contained in:
kdletters
2026-05-26 17:37:40 +08:00
parent b388b124da
commit 2d31e19791
12 changed files with 37 additions and 25 deletions

View File

@@ -411,7 +411,7 @@ test('puzzle workspace falls back to compile action for restored sessions', () =
});
});
test('puzzle workspace switches the image model from the description box', () => {
test('puzzle workspace switches image mode without exposing model names', () => {
const onCreateFromForm = vi.fn();
render(
@@ -427,9 +427,9 @@ test('puzzle workspace switches the image model from the description box', () =>
fireEvent.change(screen.getByLabelText('画面描述'), {
target: { value: '一只猫在雨夜灯牌下回头。' },
});
fireEvent.click(screen.getByRole('button', { name: '图片模型' }));
expect(screen.queryByRole('menuitemradio', { name: '原模型' })).toBeNull();
fireEvent.click(screen.getByRole('menuitemradio', { name: 'nanobanana2' }));
fireEvent.click(screen.getByRole('button', { name: '图片生成模式' }));
expect(screen.queryByText(/gpt|nanobanana|gemini/u)).toBeNull();
fireEvent.click(screen.getByRole('menuitemradio', { name: '创意模式' }));
fireEvent.click(screen.getByRole('button', { name: /稿/u }));
confirmPuzzlePointCost();

View File

@@ -45,8 +45,8 @@ export function PuzzleImageModelPicker({
className={`inline-flex min-h-8 max-w-[10rem] items-center rounded-full border border-[var(--platform-subpanel-border)] bg-white/96 px-3 text-[11px] font-bold text-[var(--platform-text-strong)] shadow-sm transition hover:bg-[var(--platform-subpanel-fill)] ${disabled ? 'cursor-not-allowed opacity-55' : ''}`}
aria-haspopup="menu"
aria-expanded={isOpen}
aria-label="图片模型"
title="图片模型"
aria-label="图片生成模式"
title="图片生成模式"
>
<span className="truncate">
{getPuzzleImageModelLabel(normalizedValue)}

View File

@@ -9,8 +9,8 @@ export const PUZZLE_IMAGE_MODEL_OPTIONS: Array<{
id: PuzzleImageModelId;
label: string;
}> = [
{ id: PUZZLE_IMAGE_MODEL_GPT_IMAGE_2, label: 'gpt-image-2' },
{ id: PUZZLE_IMAGE_MODEL_NANOBANANA2, label: 'nanobanana2' },
{ id: PUZZLE_IMAGE_MODEL_GPT_IMAGE_2, label: '标准模式' },
{ id: PUZZLE_IMAGE_MODEL_NANOBANANA2, label: '创意模式' },
];
export function normalizePuzzleImageModel(
@@ -25,6 +25,6 @@ export function normalizePuzzleImageModel(
export function getPuzzleImageModelLabel(model: PuzzleImageModelId) {
return (
PUZZLE_IMAGE_MODEL_OPTIONS.find((option) => option.id === model)?.label ??
'gpt-image-2'
'标准模式'
);
}