Files
video-create/web/server/agent/tools/create-account.ts
sion123 2ab5396461 refactor(agent): 将 tools 模块拆分为独立文件并优化导入路径
将 `tools.ts` 拆分为按功能划分的独立文件,并存放于 `tools/` 目录下,同时更新导入路径;优化 agent 系统提示语,移除冗余的「美图 Agent」前缀。
2026-05-08 01:05:37 +08:00

35 lines
1.6 KiB
TypeScript

import { execSync } from 'child_process';
import { PIPELINE_SCRIPT, PROJECT_ROOT } from './shared';
import type { ToolDefinition } from './types';
export const createAccount: ToolDefinition = {
name: 'create_account',
description: '创建新的短视频账号。需要提供账号ID、名称和描述。创建后可在 accounts/ 目录下找到配置。',
input_schema: {
type: 'object',
properties: {
id: { type: 'string', description: '账号唯一标识,英文小写,如 military-account' },
name: { type: 'string', description: '账号显示名称,中文,如 军事账号' },
desc: { type: 'string', description: '账号描述,说明视频风格和主题' },
imageModel: { type: 'string', description: '生图模型: gemini, mj, gpt, kling' },
videoModel: { type: 'string', description: '视频模型: veo3-fast, veo3-fast-frames, kling, grok' },
format: { type: 'string', description: '画幅: 9:16 (竖屏), 16:9 (横屏), 1:1 (方形)' },
},
required: ['id', 'name'],
},
execute: async (params) => {
const { id, name, desc, imageModel, videoModel, format } = params as Record<string, string>;
const cmd = [
`node "${PIPELINE_SCRIPT}" create-account`,
`--id "${id}"`,
`--name "${name}"`,
`--desc "${desc || ''}"`,
`--video-model ${videoModel || 'veo3-fast'}`,
imageModel ? `--image-model ${imageModel}` : '',
format ? `--format ${format}` : '',
].filter(Boolean).join(' ');
const result = execSync(cmd, { cwd: PROJECT_ROOT, encoding: 'utf-8' });
return `账号「${name}」创建成功。\n${result}`;
},
};