refactor(agent): 将 tools 模块拆分为独立文件并优化导入路径
将 `tools.ts` 拆分为按功能划分的独立文件,并存放于 `tools/` 目录下,同时更新导入路径;优化 agent 系统提示语,移除冗余的「美图 Agent」前缀。
This commit is contained in:
23
web/server/agent/tools/get-account-config.ts
Normal file
23
web/server/agent/tools/get-account-config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user