Files
video-create/web/server/agent/index.ts

40 lines
1023 B
TypeScript
Raw Normal View History

import { tools, ToolDefinition } from './tools';
export class VideoAgent {
private tools: ToolDefinition[];
constructor() {
this.tools = tools;
}
getToolDefinitions() {
return this.tools.map((t) => ({
name: t.name,
description: t.description,
parameters: t.parameters,
}));
}
async executeTool(name: string, params: Record<string, unknown>): Promise<string> {
const tool = this.tools.find((t) => t.name === name);
if (!tool) throw new Error(`Unknown tool: ${name}`);
return tool.execute(params);
}
getSystemPrompt(accountContext?: string): string {
return `你是美图 Agent帮助用户进行短视频创作。
${accountContext || '暂无'}
1.
2.
3. pipelineTTS
4.
`;
}
}
export const videoAgent = new VideoAgent();