fix(core): standardize multiimage template metadata
This commit is contained in:
1 parent
d0f1d45c17
commit
75a87f326e
3 files changed
+25
-2
No files matched your search
+2
-2
@@ -2,7 +2,7 @@ import { Template, MessageTemplate } from '../../../types'
|
||||
|
||||
export const template: Template = {
|
||||
id: 'multiimage-optimize-en',
|
||||
name: 'Multi-image Prompt Optimize',
|
||||
name: 'Multi-Image Optimization',
|
||||
content: [
|
||||
{
|
||||
role: 'system',
|
||||
@@ -42,7 +42,7 @@ Output only the optimized prompt:`
|
||||
version: '1.0.0',
|
||||
lastModified: 1712073600000,
|
||||
author: 'System',
|
||||
description: 'Multi-image prompt optimization template using Image 1 / Image 2 / Image 3 references',
|
||||
description: 'Multi-image prompt optimization template, organizing user requests around Image 1 / Image 2 / Image 3 relationships',
|
||||
templateType: 'multiimageOptimize',
|
||||
language: 'en',
|
||||
},
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
type TemplateLanguageService,
|
||||
} from '../../../src/services/template/languageService';
|
||||
|
||||
const BUILTIN_TEMPLATE_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
||||
|
||||
describe('builtin template id consistency', () => {
|
||||
let templateManager: TemplateManager;
|
||||
let languageService: TemplateLanguageService;
|
||||
@@ -31,4 +33,12 @@ describe('builtin template id consistency', () => {
|
||||
await expect(templateManager.getTemplate(template.id)).resolves.toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it('uses kebab-case ids for all builtin templates', async () => {
|
||||
const builtinTemplates = await templateManager.listTemplates();
|
||||
|
||||
for (const template of builtinTemplates.filter(item => item.isBuiltin)) {
|
||||
expect(template.id).toMatch(BUILTIN_TEMPLATE_ID_PATTERN);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { template as multiimageOptimizeEn } from '../../../src/services/template/default-templates/image-optimize/multiimage/multiimage-optimize_en'
|
||||
|
||||
describe('multiimage template metadata', () => {
|
||||
it('uses the standardized english builtin metadata', () => {
|
||||
expect(multiimageOptimizeEn.id).toBe('multiimage-optimize-en')
|
||||
expect(multiimageOptimizeEn.name).toBe('Multi-Image Optimization')
|
||||
expect(multiimageOptimizeEn.metadata.description).toBe(
|
||||
'Multi-image prompt optimization template, organizing user requests around Image 1 / Image 2 / Image 3 relationships',
|
||||
)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user