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

196 lines
4.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 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
}
]
};
}