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

60 lines
2.3 KiB
TypeScript
Raw Normal View History

import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const PROJECT_ROOT = path.resolve(__dirname, '..', '..', '..');
export class VideoAgent {
getSystemPrompt(): string {
const accountsDir = path.join(PROJECT_ROOT, 'accounts');
let accountList = '暂无账号';
if (fs.existsSync(accountsDir)) {
const dirs = fs.readdirSync(accountsDir, { withFileTypes: true })
.filter((d) => d.isDirectory() && !d.name.startsWith('_') && !d.name.startsWith('.'));
if (dirs.length > 0) {
accountList = dirs.map((d) => {
const configPath = path.join(accountsDir, d.name, 'account.json');
if (fs.existsSync(configPath)) {
const cfg = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
return `- ${d.name}: ${cfg.description || '无描述'} (生图:${cfg.imageModel}, 视频:${cfg.videoModel}, 画幅:${cfg.defaultFormat})`;
}
return `- ${d.name}`;
}).join('\n');
}
}
return `你是专业的短视频创作助手。你可以帮助用户完成从创意到成片的完整流程。
##
${accountList}
##
1. **** - 使 list_accounts
2. **** - 使 create_account /
3. **** - 使 get_account_config
4. ** Pipeline ** - 使 pipeline_status
5. **** - 使 run_pipeline_phase pipeline
##
1. A. / B.AI视频
2. /
3.
4. images
5. videos B
6. tts
7. assemble
##
-
-
- pipeline manifest
-
- 使`;
}
}
export const videoAgent = new VideoAgent();