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

24 lines
838 B
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.
import path from 'path';
import fs from 'fs';
import { ACCOUNTS_DIR, loadJSON } from './shared';
import type { ToolDefinition } from './types';
export const getAccountConfig: ToolDefinition = {
name: 'get_account_config',
description: '获取指定账号的完整配置包括模型选择、TTS语音、字幕风格等',
input_schema: {
type: 'object',
properties: {
accountId: { type: 'string', description: '账号ID如 军事账号' },
},
required: ['accountId'],
},
execute: async (params) => {
const { accountId } = params as { accountId: string };
const configPath = path.join(ACCOUNTS_DIR, accountId, 'account.json');
if (!fs.existsSync(configPath)) return `账号「${accountId}」不存在`;
const cfg = loadJSON(configPath);
return JSON.stringify(cfg, null, 2);
},
};