feat(web): add pi-agent tool layer with pipeline integration
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
39
web/server/agent/index.ts
Normal file
39
web/server/agent/index.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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. 执行视频创作 pipeline(分镜→生图→生视频→TTS→成片)
|
||||
4. 管理提示词模板
|
||||
|
||||
用户想创作视频时,一步步引导他们完成流程。`;
|
||||
}
|
||||
}
|
||||
|
||||
export const videoAgent = new VideoAgent();
|
||||
Reference in New Issue
Block a user