diff --git a/packages/core/src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only.ts b/packages/core/src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only.ts new file mode 100644 index 00000000..4a90c97e --- /dev/null +++ b/packages/core/src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only.ts @@ -0,0 +1,67 @@ +import { createImageAnalysisTemplate } from '../builders'; + +export const template = createImageAnalysisTemplate( + { + id: 'evaluation-image-multiimage-prompt-only', + name: '多图生图提示词直接评估', + description: '直接评估多图生图提示词质量(多图模式)', + language: 'zh', + tags: ['evaluation', 'prompt-only', 'scoring', 'image', 'multiimage'], + }, + { + subjectLabel: { + zh: '多图生图提示词', + en: 'multi-image generation prompt', + }, + roleName: { + zh: '多图生图提示词分析专家', + en: 'Multi_Image_Prompt_Analysis_Expert', + }, + dimensions: [ + { + key: 'referenceIntegration', + label: { + zh: '参考图融合明确性', + en: 'Reference Integration', + }, + description: { + zh: '是否清晰说明多张参考图各自的作用、取舍和融合关系?', + en: 'Does it clearly state each reference image role, priority, and integration relationship?', + }, + }, + { + key: 'generationIntent', + label: { + zh: '生成目标清晰度', + en: 'Generation Intent', + }, + description: { + zh: '是否明确描述最终画面的主体、场景、构图和目标效果?', + en: 'Does it clearly describe the final subject, scene, composition, and target effect?', + }, + }, + { + key: 'constraintClarity', + label: { + zh: '保留与修改约束', + en: 'Preservation and Edit Constraints', + }, + description: { + zh: '是否准确说明哪些元素应保留、替换、强化或弱化?', + en: 'Does it accurately specify which elements should be preserved, replaced, emphasized, or reduced?', + }, + }, + { + key: 'styleConsistency', + label: { + zh: '风格一致性', + en: 'Style Consistency', + }, + description: { + zh: '是否给出足够的风格、光影、色彩和质量约束来统一多图来源?', + en: 'Does it provide enough style, lighting, color, and quality constraints to unify multiple image sources?', + }, + }, + ], + }, +); diff --git a/packages/core/src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only_en.ts b/packages/core/src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only_en.ts new file mode 100644 index 00000000..99e67a45 --- /dev/null +++ b/packages/core/src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only_en.ts @@ -0,0 +1,67 @@ +import { createImageAnalysisTemplate } from '../builders'; + +export const template = createImageAnalysisTemplate( + { + id: 'evaluation-image-multiimage-prompt-only', + name: 'Multi-Image Prompt Direct Evaluation', + description: 'Direct evaluation of multi-image generation prompt quality', + language: 'en', + tags: ['evaluation', 'prompt-only', 'scoring', 'image', 'multiimage'], + }, + { + subjectLabel: { + zh: '多图生图提示词', + en: 'multi-image generation prompt', + }, + roleName: { + zh: '多图生图提示词分析专家', + en: 'Multi_Image_Prompt_Analysis_Expert', + }, + dimensions: [ + { + key: 'referenceIntegration', + label: { + zh: '参考图融合明确性', + en: 'Reference Integration', + }, + description: { + zh: '是否清晰说明多张参考图各自的作用、取舍和融合关系?', + en: 'Does it clearly state each reference image role, priority, and integration relationship?', + }, + }, + { + key: 'generationIntent', + label: { + zh: '生成目标清晰度', + en: 'Generation Intent', + }, + description: { + zh: '是否明确描述最终画面的主体、场景、构图和目标效果?', + en: 'Does it clearly describe the final subject, scene, composition, and target effect?', + }, + }, + { + key: 'constraintClarity', + label: { + zh: '保留与修改约束', + en: 'Preservation and Edit Constraints', + }, + description: { + zh: '是否准确说明哪些元素应保留、替换、强化或弱化?', + en: 'Does it accurately specify which elements should be preserved, replaced, emphasized, or reduced?', + }, + }, + { + key: 'styleConsistency', + label: { + zh: '风格一致性', + en: 'Style Consistency', + }, + description: { + zh: '是否给出足够的风格、光影、色彩和质量约束来统一多图来源?', + en: 'Does it provide enough style, lighting, color, and quality constraints to unify multiple image sources?', + }, + }, + ], + }, +); diff --git a/packages/core/src/services/template/default-templates/evaluation/image/multiimage/index.ts b/packages/core/src/services/template/default-templates/evaluation/image/multiimage/index.ts new file mode 100644 index 00000000..d5dbc3fc --- /dev/null +++ b/packages/core/src/services/template/default-templates/evaluation/image/multiimage/index.ts @@ -0,0 +1,6 @@ +/** + * 评估模板 - 图像模式/多图生图 + */ + +export { template as evaluationImageMultiImagePromptOnly } from './evaluation-prompt-only'; +export { template as evaluationImageMultiImagePromptOnlyEn } from './evaluation-prompt-only_en'; diff --git a/packages/core/src/services/template/default-templates/evaluation/index.ts b/packages/core/src/services/template/default-templates/evaluation/index.ts index afb8d73f..29d5c234 100644 --- a/packages/core/src/services/template/default-templates/evaluation/index.ts +++ b/packages/core/src/services/template/default-templates/evaluation/index.ts @@ -63,3 +63,9 @@ export { evaluationImageImage2ImagePromptOnly, evaluationImageImage2ImagePromptOnlyEn, } from './image/image2image'; + +// 图像模式 - 多图生图评估 +export { + evaluationImageMultiImagePromptOnly, + evaluationImageMultiImagePromptOnlyEn, +} from './image/multiimage'; diff --git a/packages/core/src/services/template/default-templates/index.ts b/packages/core/src/services/template/default-templates/index.ts index 7d30f5ae..4b90137b 100644 --- a/packages/core/src/services/template/default-templates/index.ts +++ b/packages/core/src/services/template/default-templates/index.ts @@ -120,6 +120,9 @@ import { template as evaluation_image_text2image_compare_en } from './evaluation // 评估模板 - 图像模式/图生图 import { template as evaluation_image_image2image_prompt_only } from './evaluation/image/image2image/evaluation-prompt-only'; import { template as evaluation_image_image2image_prompt_only_en } from './evaluation/image/image2image/evaluation-prompt-only_en'; +// 评估模板 - 图像模式/多图生图 +import { template as evaluation_image_multiimage_prompt_only } from './evaluation/image/multiimage/evaluation-prompt-only'; +import { template as evaluation_image_multiimage_prompt_only_en } from './evaluation/image/multiimage/evaluation-prompt-only_en'; // 变量提取模板 import { variableExtractionTemplate } from './variable-extraction'; @@ -257,6 +260,9 @@ export const ALL_TEMPLATES = { // 评估模板 - 图像模式/图生图 evaluation_image_image2image_prompt_only, evaluation_image_image2image_prompt_only_en, + // 评估模板 - 图像模式/多图生图 + evaluation_image_multiimage_prompt_only, + evaluation_image_multiimage_prompt_only_en, // 变量提取模板 variableExtractionTemplate, variableExtractionTemplateEn, diff --git a/packages/core/tests/unit/template/image-evaluation-prompt-only-json-injection.test.ts b/packages/core/tests/unit/template/image-evaluation-prompt-only-json-injection.test.ts index 81c5bbef..e51d4e2d 100644 --- a/packages/core/tests/unit/template/image-evaluation-prompt-only-json-injection.test.ts +++ b/packages/core/tests/unit/template/image-evaluation-prompt-only-json-injection.test.ts @@ -4,6 +4,8 @@ import { template as text2imagePromptOnlyZh } from '../../../src/services/templa import { template as text2imagePromptOnlyEn } from '../../../src/services/template/default-templates/evaluation/image/text2image/evaluation-prompt-only_en'; import { template as image2imagePromptOnlyZh } from '../../../src/services/template/default-templates/evaluation/image/image2image/evaluation-prompt-only'; import { template as image2imagePromptOnlyEn } from '../../../src/services/template/default-templates/evaluation/image/image2image/evaluation-prompt-only_en'; +import { template as multiimagePromptOnlyZh } from '../../../src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only'; +import { template as multiimagePromptOnlyEn } from '../../../src/services/template/default-templates/evaluation/image/multiimage/evaluation-prompt-only_en'; describe('image evaluation prompt-only templates JSON evidence injection', () => { const baseContext: TemplateContext = { @@ -23,6 +25,8 @@ describe('image evaluation prompt-only templates JSON evidence injection', () => ['en-text2image', text2imagePromptOnlyEn], ['zh-image2image', image2imagePromptOnlyZh], ['en-image2image', image2imagePromptOnlyEn], + ['zh-multiimage', multiimagePromptOnlyZh], + ['en-multiimage', multiimagePromptOnlyEn], ])('should render %s image evaluation prompt-only template with JSON-wrapped evidence', (_label, template) => { const messages = TemplateProcessor.processTemplate(template, baseContext); diff --git a/packages/core/tests/unit/template/image-evaluation-templates.test.ts b/packages/core/tests/unit/template/image-evaluation-templates.test.ts index 5472b29d..7c508230 100644 --- a/packages/core/tests/unit/template/image-evaluation-templates.test.ts +++ b/packages/core/tests/unit/template/image-evaluation-templates.test.ts @@ -66,6 +66,18 @@ describe('image text2image evaluation templates', () => { expect(promptOnlyTemplate?.content[0]?.content).toContain('只输出合法 JSON,禁止 Markdown') }) + it('registers the zh-CN multiimage prompt-only template', async () => { + vi.spyOn(languageService, 'getCurrentLanguage').mockReturnValue('zh-CN') + + const promptOnlyTemplate = await templateManager.getTemplate('evaluation-image-multiimage-prompt-only') + + expect(promptOnlyTemplate).toBeDefined() + expect(promptOnlyTemplate?.content[0]?.content).toContain('当前工作区多图生图提示词') + expect(promptOnlyTemplate?.content[0]?.content).toContain('参考图融合明确性') + expect(promptOnlyTemplate?.content[1]?.content).toContain('"workspacePrompt":') + expect(promptOnlyTemplate?.content[1]?.content).toContain('"analysisStage":') + }) + it('registers the zh-CN image prompt-iterate template with iteration evidence', async () => { vi.spyOn(languageService, 'getCurrentLanguage').mockReturnValue('zh-CN') @@ -124,6 +136,18 @@ describe('image text2image evaluation templates', () => { expect(promptOnlyTemplate?.content[0]?.content).toContain('No Markdown, no code fences') }) + it('registers the en-US multiimage prompt-only template', async () => { + vi.spyOn(languageService, 'getCurrentLanguage').mockReturnValue('en-US') + + const promptOnlyTemplate = await templateManager.getTemplate('evaluation-image-multiimage-prompt-only') + + expect(promptOnlyTemplate).toBeDefined() + expect(promptOnlyTemplate?.content[0]?.content).toContain('current workspace multi-image generation prompt') + expect(promptOnlyTemplate?.content[0]?.content).toContain('Reference Integration') + expect(promptOnlyTemplate?.content[1]?.content).toContain('"workspacePrompt":') + expect(promptOnlyTemplate?.content[1]?.content).toContain('"analysisStage":') + }) + it('registers the en-US image prompt-iterate template with iteration evidence', async () => { vi.spyOn(languageService, 'getCurrentLanguage').mockReturnValue('en-US') diff --git a/packages/ui/src/components/context-mode/ContextSystemWorkspace.vue b/packages/ui/src/components/context-mode/ContextSystemWorkspace.vue index aff4a6a2..a1c96242 100644 --- a/packages/ui/src/components/context-mode/ContextSystemWorkspace.vue +++ b/packages/ui/src/components/context-mode/ContextSystemWorkspace.vue @@ -135,6 +135,7 @@ @open-preview="handleOpenPromptPreview" @apply-to-conversation="handleApplyToConversation" @apply-improvement="handleApplyImprovement" + @apply-patch="handleApplyLocalPatch" @save-local-edit="handleSaveLocalEdit" /> diff --git a/packages/ui/src/components/context-mode/ContextUserTestPanel.vue b/packages/ui/src/components/context-mode/ContextUserTestPanel.vue index b414fc63..b4ff284d 100644 --- a/packages/ui/src/components/context-mode/ContextUserTestPanel.vue +++ b/packages/ui/src/components/context-mode/ContextUserTestPanel.vue @@ -63,6 +63,7 @@ @show-primary-detail="emit('show-primary-detail')" @show-secondary-detail="emit('show-secondary-detail')" @apply-improvement="emit('apply-improvement', $event)" + @apply-patch="emit('apply-patch', $event)" >