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

60 lines
2.7 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. **** - 使 get_account_prompts //
5. **** - 使 validate_storyboard TTS ratio
6. ** Manifest** - 使 create_manifest
7. ** Manifest** - 使 update_manifest_items imagePrompt/videoPrompt
8. **** - 使 generate_images run_pipeline_phase --phase images
9. **** - 使 confirm_images
10. **** - 使 generate_videos run_pipeline_phase --phase upload,videos
11. **TTS + ** - 使 run_pipeline_phase --phase tts,assemble
12. **** - 使 pipeline_status
13. **** - 使 list_outputs
14. ** Manifest** - 使 get_manifest manifest
##
-
-
- pipeline manifest
-
- 使`;
}
}
export const videoAgent = new VideoAgent();