ttrpg-tools/src/cli/prompts/setup-deck-display.ts

196 lines
4.0 KiB
TypeScript
Raw Normal View History

2026-03-18 12:12:43 +08:00
/**
* setup-deck-display Prompt
*
*
*/
export interface SetupDeckDisplayOptions {
/**
* CSV
*/
csv_file?: string;
/**
*
*/
usage?: string;
}
export interface SetupDeckDisplayResult {
messages: PromptMessage[];
}
export interface PromptMessage {
role: 'user' | 'assistant';
content: TextContent | ImageContent | AudioContent | ResourceContent;
}
export interface TextContent {
type: 'text';
text: string;
}
export interface ImageContent {
type: 'image';
data: string;
mimeType: string;
}
export interface AudioContent {
type: 'audio';
data: string;
mimeType: string;
}
export interface ResourceContent {
type: 'resource';
resource: {
uri: string;
mimeType: string;
text?: string;
blob?: string;
};
}
/**
* setup-deck-display prompt
*/
export function setupDeckDisplay(options?: SetupDeckDisplayOptions): SetupDeckDisplayResult {
const csvFile = options?.csv_file || './content/deck.csv';
const usage = options?.usage || '桌面游戏';
const messages: PromptMessage[] = [
{
role: 'user',
content: {
type: 'text',
text: `我想配置"${csvFile}"卡牌组的显示参数,主要用于"${usage}"。请帮我设置合适的尺寸和布局。`
}
},
{
role: 'assistant',
content: {
type: 'text',
text: `好的!我来帮你配置"${csvFile}"卡牌组的显示参数。
##
###
| | (mm) | |
|---------|----------|------|
| | 57x89 | |
| | 63x88 | |
| | 44x68 | |
| | 57x57 | |
| | 70x120 | |
| | | |
---
##
A4
| | | A4 |
|---------|---------|-------------|
| 57x89 | 5 x 6 | 30 |
| 63x88 | 5 x 5 | 25 |
| 44x68 | 6 x 8 | 48 |
| 57x57 | 6 x 6 | 36 |
| 70x120 | 3 x 4 | 12 |
---
##
### (Bleed)
- 1mm
- 0mm
- 2-3mm
### (Padding)
- 2mm
- 1mm
- 3-4mm
###
- rectangle-
- circle
- hex
- diamond
---
##
\`字段名:起始行 - 结束行,字体大小\`
\`\`\`
layers="name:1-2,14 type:3-3,10 effect:4-8,9"
\`\`\`
- name 1-2 14
- type 3 10
- effect 4-8 9
---
****
1.
2.
3. /
4.
---
****
\`\`\`json
{
"deck": {
"size": "63x88",
"grid": "5x5",
"bleed": 1,
"padding": 2,
"shape": "rectangle",
"layers": "name:1-2,14 type:3-3,10 effect:4-8,9"
}
}
\`\`\``
}
}
];
return { messages };
}
/**
* prompt
*/
export function getSetupDeckDisplayPrompt() {
return {
name: 'setup-deck-display',
title: '配置卡牌显示',
description: '引导用户配置卡牌的显示参数(尺寸、布局、样式等)',
arguments: [
{
name: 'csv_file',
description: 'CSV 文件路径',
required: false
},
{
name: 'usage',
description: '卡牌用途(如:桌面游戏、印刷、在线预览等)',
required: false
}
]
};
}