1324f1575d
- 重寫 action.yaml:支援所有 LLM providers 的 inputs - 重寫 Dockerfile:python:3.11-slim + git - 重寫 entrypoint.sh:啟動 app/main.py - app/config.py:環境變數與 LLM 自動偵測 - app/llm.py:OpenAI-compatible 統一介面 - app/gitea.py:PR diff 取得與 comment 發布 - app/roles.py:從 prompts/roles/*.yaml 載入角色 - app/main.py:pipeline 骨架,log 每個主要階段 - app/prompts/roles/:五個角色定義(Aria/Rex/Zara/Leo/Maya)
23 lines
657 B
Python
23 lines
657 B
Python
import os
|
|
import yaml
|
|
|
|
ROLES_DIR = "/action/app/prompts/roles"
|
|
|
|
|
|
def load_roles() -> list[dict]:
|
|
"""載入所有角色定義"""
|
|
roles = []
|
|
for fname in sorted(os.listdir(ROLES_DIR)):
|
|
if fname.endswith(".yaml"):
|
|
with open(os.path.join(ROLES_DIR, fname), "r", encoding="utf-8") as f:
|
|
roles.append(yaml.safe_load(f))
|
|
return roles
|
|
|
|
|
|
def get_role_intro(roles: list[dict]) -> str:
|
|
"""產生角色介紹文字(用於 comment)"""
|
|
lines = ["## 🤖 AI Code Review 團隊", ""]
|
|
for r in roles:
|
|
lines.append(f"- **{r['name']}** ({r['role']}): {r['personality']}")
|
|
return "\n".join(lines)
|