feat: 階段一 - 基本流程串接骨架

- 重寫 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)
This commit is contained in:
2026-05-11 07:23:06 +00:00
parent 6e8b6492da
commit 1324f1575d
14 changed files with 490 additions and 28 deletions
+22
View File
@@ -0,0 +1,22 @@
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)