Compare commits

..

5 Commits

4 changed files with 38 additions and 12 deletions
+3 -2
View File
@@ -33,8 +33,9 @@ jobs:
- name: AI Code Review - name: AI Code Review
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@v${{ needs.version.outputs.version }} uses: https://gitea.jsc.idv.tw/jiantw83/code-review@v${{ needs.version.outputs.version }}
with: with:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OPENAI_BASE_URL: https://openrouter.ai/api/v1 GEMINI_BASE_URL: https://generativelanguage.googleapis.com/v1beta
GEMINI_MODEL: ${{ vars.GEMINI_MODEL }}
permissions: permissions:
contents: write contents: write
pull-requests: write pull-requests: write
+28 -7
View File
@@ -28,7 +28,7 @@
2.`.gitea/workflows` 資料夾中建立 `ai-review.yaml' 2.`.gitea/workflows` 資料夾中建立 `ai-review.yaml'
3.`ai-review.yaml` 中填入以下內容(選擇一個使用) 3.`ai-review.yaml` 中填入以下內容(選擇一個使用)
### 1. OpenAIOpenRouter ### 1. OpenAI
```yaml ```yaml
name: AI name: AI
on: on:
@@ -42,9 +42,29 @@ jobs:
- name: AI Code Review - name: AI Code Review
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }} uses: https://gitea.jsc.idv.tw/jiantw83/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }}
with: with:
# Github (h3285@evertrust.com.tw)
# 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
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: https://api.openai.com/v1
permissions:
contents: write
pull-requests: write
issues: write
```
### 2. OpenRouter
```yaml
name: AI
on:
pull_request:
types: [opened, synchronize]
jobs:
code-review:
name: 'Code Review'
runs-on: ubuntu
steps:
- name: AI Code Review
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }}
with:
OPENAI_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENAI_BASE_URL: https://openrouter.ai/api/v1 OPENAI_BASE_URL: https://openrouter.ai/api/v1
permissions: permissions:
contents: write contents: write
@@ -52,7 +72,7 @@ jobs:
issues: write issues: write
``` ```
### 2. Anthropic Claude ### 3. Anthropic Claude
```yaml ```yaml
name: AI name: AI
on: on:
@@ -74,7 +94,7 @@ jobs:
issues: write issues: write
``` ```
### 3. Google Gemini ### 4. Google Gemini
```yaml ```yaml
name: AI name: AI
on: on:
@@ -90,13 +110,14 @@ jobs:
with: with:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GEMINI_BASE_URL: https://generativelanguage.googleapis.com/v1beta GEMINI_BASE_URL: https://generativelanguage.googleapis.com/v1beta
GEMINI_MODEL: ${{ vars.GEMINI_MODEL }}
permissions: permissions:
contents: write contents: write
pull-requests: write pull-requests: write
issues: write issues: write
``` ```
### 4. Amazon Q ### 5. Amazon Q
```yaml ```yaml
name: AI name: AI
on: on:
@@ -118,7 +139,7 @@ jobs:
issues: write issues: write
``` ```
### 5. SonarQube ### 6. SonarQube
```yaml ```yaml
name: AI name: AI
on: on:
+1 -1
View File
@@ -12,7 +12,7 @@ export function getLLMConfig() {
const checks = [ const checks = [
['openai', process.env.OPENAI_API_KEY, process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1', process.env.OPENAI_MODEL || 'gpt-4o-mini'], ['openai', process.env.OPENAI_API_KEY, process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1', process.env.OPENAI_MODEL || 'gpt-4o-mini'],
['claude', process.env.CLAUDE_API_KEY, process.env.CLAUDE_BASE_URL || 'https://api.anthropic.com/v1', process.env.CLAUDE_MODEL || 'claude-3-haiku-20240307'], ['claude', process.env.CLAUDE_API_KEY, process.env.CLAUDE_BASE_URL || 'https://api.anthropic.com/v1', process.env.CLAUDE_MODEL || 'claude-3-haiku-20240307'],
['gemini', process.env.GEMINI_API_KEY, process.env.GEMINI_BASE_URL || 'https://generativelanguage.googleapis.com/v1beta', process.env.GEMINI_MODEL || 'gemini-1.5-flash'], ['gemini', process.env.GEMINI_API_KEY, process.env.GEMINI_BASE_URL || 'https://generativelanguage.googleapis.com/v1beta', process.env.GEMINI_MODEL || 'gemini-2.5-flash'],
['ollama', 'ollama', process.env.OLLAMA_BASE_URL, process.env.OLLAMA_MODEL], ['ollama', 'ollama', process.env.OLLAMA_BASE_URL, process.env.OLLAMA_MODEL],
['amazonq', process.env.AMAZONQ_API_KEY, process.env.AMAZONQ_BASE_URL || 'https://q.api.aws', process.env.OPENAI_MODEL || 'amazon-q'], ['amazonq', process.env.AMAZONQ_API_KEY, process.env.AMAZONQ_BASE_URL || 'https://q.api.aws', process.env.OPENAI_MODEL || 'amazon-q'],
['kilo', process.env.KILO_API_KEY, process.env.KILO_BASE_URL || 'https://api.kilocode.com/v1', process.env.OPENAI_MODEL || 'kilo-default'], ['kilo', process.env.KILO_API_KEY, process.env.KILO_BASE_URL || 'https://api.kilocode.com/v1', process.env.OPENAI_MODEL || 'kilo-default'],
+6 -2
View File
@@ -12,9 +12,13 @@ export function loadRoles() {
} }
export function getRoleIntro(roles) { export function getRoleIntro(roles) {
const lines = ['## 🤖 AI Code Review 團隊', '']; const lines = [
'## 🤖 AI Code Review 團隊', '',
'| 👤 名稱 | 🎯 職責 | 🧠 個性 |',
'|--------|--------|--------|',
];
for (const r of roles) { for (const r of roles) {
lines.push(`- **${r.name}** (${r.role})${r.personality}`); lines.push(`| **${r.name}** | ${r.role} | ${r.personality} |`);
} }
return lines.join('\n'); return lines.join('\n');
} }