22 lines
1.6 KiB
JavaScript
22 lines
1.6 KiB
JavaScript
// Offline verification data only; the resource bridge here never reads product files.
|
|
const now = Date.now()
|
|
const svgImage = (color, label) => `data:image/svg+xml;base64,${Buffer.from(`<svg xmlns="http://www.w3.org/2000/svg" width="320" height="160"><rect width="320" height="160" rx="12" fill="${color}"/><text x="160" y="88" text-anchor="middle" fill="white" font-size="28">${label}</text></svg>`).toString('base64')}`
|
|
const content = [
|
|
'## 图表、图片与文件交互', '',
|
|
'```mermaid', 'flowchart LR', ' A[输入] --> B[处理]', ' B --> C[输出]', '```', '',
|
|
'点击文件 `src/example.ts#L4-L7` 或目录 `src` 查看内容。', '',
|
|
'```ts:4:7:src/example.ts', 'export const result = input.map(transform)', '```', '',
|
|
'', '', '', '',
|
|
'以下验证错误图表仍可查看源码:', '',
|
|
'```mermaid', 'flowchart LR', ' A[unclosed', '```'
|
|
].join('\n')
|
|
export const dialogueMediaFixture = {
|
|
sessions: [{ id: 'dialogue-media', title: '图表、图片与文件交互', createdAt: now, updatedAt: now }],
|
|
messages: { 'dialogue-media': [
|
|
{ id: 'media-user', role: 'user', content: '验证图表缩放和下载、图片预览、文件行号跳转。', status: 'done', createdAt: now },
|
|
{ id: 'media-assistant', role: 'assistant', content, parts: [{ type: 'text', text: content }], tools: [], status: 'done', createdAt: now }
|
|
] },
|
|
images: { 'images/blue.svg': svgImage('#3567be', 'Image A'), 'images/green.svg': svgImage('#277c64', 'Image B') },
|
|
files: { 'src/example.ts': Array.from({ length: 32 }, (_, i) => `// example line ${i + 1}`).join('\n') }
|
|
}
|