27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
|
|
import { execSync } from 'child_process';
|
|||
|
|
import { PIPELINE_SCRIPT, PROJECT_ROOT } from './shared';
|
|||
|
|
import type { ToolDefinition } from './types';
|
|||
|
|
|
|||
|
|
export const confirmImages: ToolDefinition = {
|
|||
|
|
name: 'confirm_images',
|
|||
|
|
description: '确认分镜图质量,将 manifest 中所有图片标记为 confirmed=true。也可以跳过确认直接批量确认。',
|
|||
|
|
input_schema: {
|
|||
|
|
type: 'object',
|
|||
|
|
properties: {
|
|||
|
|
manifestPath: { type: 'string', description: 'manifest.json 路径' },
|
|||
|
|
skip: { type: 'boolean', description: '跳过人工确认,直接全部确认(默认 false)' },
|
|||
|
|
},
|
|||
|
|
required: ['manifestPath'],
|
|||
|
|
},
|
|||
|
|
execute: async (params) => {
|
|||
|
|
const { manifestPath, skip = false } = params as { manifestPath: string; skip?: boolean };
|
|||
|
|
try {
|
|||
|
|
const cmd = `node "${PIPELINE_SCRIPT}" confirm --manifest "${manifestPath}"${skip ? ' --all' : ''}`;
|
|||
|
|
const output = execSync(cmd, { cwd: PROJECT_ROOT, encoding: 'utf-8' });
|
|||
|
|
return `图片确认完成:\n${output}`;
|
|||
|
|
} catch (err: any) {
|
|||
|
|
return `确认失败: ${err.message}`;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
};
|