ec1f6c96e7
- Dockerfile: 改用 node:20-slim - entrypoint.sh: 執行 app/main.js - app/package.json: axios + js-yaml + openai - app/config.js: 環境變數與 LLM 自動偵測(10 種服務) - app/llm.js: OpenAI-compatible 統一介面 - app/gitea.js: PR diff 取得與 comment 發布 - app/roles.js: 從 prompts/roles/*.yaml 載入角色 - app/main.js: pipeline 骨架,log 每個主要階段
21 lines
536 B
JavaScript
21 lines
536 B
JavaScript
import fs from 'fs';
|
||
import path from 'path';
|
||
import yaml from 'js-yaml';
|
||
|
||
const ROLES_DIR = '/action/app/prompts/roles';
|
||
|
||
export function loadRoles() {
|
||
return fs.readdirSync(ROLES_DIR)
|
||
.filter(f => f.endsWith('.yaml'))
|
||
.sort()
|
||
.map(f => yaml.load(fs.readFileSync(path.join(ROLES_DIR, f), 'utf8')));
|
||
}
|
||
|
||
export function getRoleIntro(roles) {
|
||
const lines = ['## 🤖 AI Code Review 團隊', ''];
|
||
for (const r of roles) {
|
||
lines.push(`- **${r.name}** (${r.role}):${r.personality}`);
|
||
}
|
||
return lines.join('\n');
|
||
}
|