Files
video-create/web/server/agent/tools/get-account-config.ts

24 lines
838 B
TypeScript
Raw Normal View History

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);
},
};