Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ecb018ef4 | |||
| 02529a4ec9 | |||
| 624a71836c | |||
| fb1254aa32 | |||
| 6eae6eb0ce | |||
| ed1f2bea15 | |||
| 9a11d25c00 |
@@ -28,9 +28,8 @@ jobs:
|
||||
- name: AI Code Review
|
||||
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@v${{ needs.version.outputs.version }}
|
||||
with:
|
||||
OPENAI_API_KEY: ${{ secrets.HF_API_KEY }}
|
||||
OPENAI_BASE_URL: https://router.huggingface.co/novita/v1
|
||||
OPENAI_MODEL: deepseek-ai/DeepSeek-R1
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
OPENAI_BASE_URL: https://api.openai.com/v1
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
@@ -41,8 +41,10 @@ jobs:
|
||||
- name: AI Code Review
|
||||
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }}
|
||||
with:
|
||||
# Github (h3285@evertrust.com.tw)
|
||||
# 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
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
OPENAI_BASE_URL: https://api.openai.com/v1
|
||||
OPENAI_BASE_URL: https://openrouter.ai/api/v1
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
+1
-8
@@ -16,16 +16,9 @@ export async function chat(systemPrompt, userContent) {
|
||||
};
|
||||
if (provider === 'claude') headers['anthropic-version'] = '2023-06-01';
|
||||
|
||||
// 部分模型(如 DeepSeek-R1)不支援 system role,改合併到 user message
|
||||
const NO_SYSTEM_ROLE_MODELS = ['deepseek-ai/deepseek-r1', 'deepseek-r1'];
|
||||
const isNoSystemRole = NO_SYSTEM_ROLE_MODELS.some(m => model.toLowerCase().includes(m.toLowerCase()));
|
||||
const messages = isNoSystemRole
|
||||
? [{ role: 'user', content: `${systemPrompt}\n\n${userContent}` }]
|
||||
: [{ role: 'system', content: systemPrompt }, { role: 'user', content: userContent }];
|
||||
|
||||
const resp = await axios.post(
|
||||
`${baseURL.replace(/\/$/, '')}/chat/completions`,
|
||||
{ model, messages, temperature: 0.2 },
|
||||
{ model, messages: [{ role: 'system', content: systemPrompt }, { role: 'user', content: userContent }], temperature: 0.2 },
|
||||
{ headers, timeout: 120000, httpsAgent }
|
||||
);
|
||||
return resp.data.choices[0].message.content;
|
||||
|
||||
Reference in New Issue
Block a user