refactor: switch ai-code-review to CLIProxyAPI
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
| 專案名稱 | 專案描述 |
|
||||
| --- | --- |
|
||||
| [AI Code Review](https://gitea.jsc.idv.tw/actions/ai-code-review/src/branch/develop/) | 此專案提供 Gitea 工作流程中的 AI 程式碼審查、findings / exclusions 管理、LLM CLI 橋接與 git / Gitea 前置驗證工具。 |
|
||||
| [AI Code Review](https://gitea.jsc.idv.tw/actions/ai-code-review/src/branch/develop/) | 此專案提供 Gitea 工作流程中的 AI 程式碼審查、findings / exclusions 管理、CLIProxyAPI 橋接與 git / Gitea 前置驗證工具。 |
|
||||
|
||||
| 專案名稱 | 參考專案列表 |
|
||||
| --- | --- |
|
||||
@@ -31,8 +31,7 @@
|
||||
| [postNewNonCriticalComment](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/comments.js#L288) | [發布新問題中的非嚴重 comment。](#postnewnoncriticalcomment) |
|
||||
| [postNewCriticalComments](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/comments.js#L304) | [發布新嚴重問題的 comment。](#postnewcriticalcomments) |
|
||||
| [getInsecureHttpsAgent](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/config.js#L60) | [取得一個關閉 TLS 憑證驗證的 HTTPS Agent 單例,供內部服務連線使用。](#getinsecurehttpsagent) |
|
||||
| [getLLMCLICommands](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/config.js#L100) | [取得目前支援的 LLM CLI 指令名稱清單。](#getllmclicommands) |
|
||||
| [getLLMConfig](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/config.js#L130) | [依環境變數與 CLI 可用性解析目前可用的 LLM 提供者設定。](#getllmconfig) |
|
||||
| [getLLMConfig](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/config.js#L130) | [依環境變數解析目前可用的 CLIProxyAPI 設定。](#getllmconfig) |
|
||||
| [analyzeWithRole](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/findings.js#L14) | [用指定角色分析 diff 並產生 findings。](#analyzewithrole) |
|
||||
| [normalizeText](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/findings.js#L120) | [將文字正規化成比對用形式。](#normalizetext) |
|
||||
| [loadOldFindings](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/findings.js#L302) | [讀取舊 findings 並標記為舊問題。](#loadoldfindings) |
|
||||
@@ -72,7 +71,7 @@
|
||||
| [ensureJSONArrayFileExists](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/json.js#L134) | [確保指定路徑存在一個 JSON 檔案,不存在時建立空陣列檔。](#ensurejsonarrayfileexists) |
|
||||
| [mapWithConcurrency](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L25) | [以可控制併發數的方式並行處理陣列項目。](#mapwithconcurrency) |
|
||||
| [extractMeaningfulError](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L96) | [從 CLI 原始輸出中擷取最有用的錯誤訊息。](#extractmeaningfulerror) |
|
||||
| [chat](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L190) | [呼叫可用的 AI 助理 CLI,並回傳文字回應。](#chat) |
|
||||
| [chat](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L190) | [呼叫 CLIProxyAPI,並回傳文字回應。](#chat) |
|
||||
| [chatJSON](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L218) | [呼叫 AI 助理並把回應解析成 JSON。](#chatjson) |
|
||||
| [extractBalancedJSON](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L255) | [從指定索引開始擷取完整平衡的 JSON 片段。](#extractbalancedjson) |
|
||||
| [extractJSONText](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/llm.js#L298) | [從雜訊文字中抽出最可能的 JSON 內容。](#extractjsontext) |
|
||||
@@ -89,8 +88,8 @@
|
||||
| [checkRequiredEnv](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L60) | [檢查前置驗證所需的必要環境值是否齊全。](#checkrequiredenv) |
|
||||
| [verifyGiteaToken](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L77) | [驗證 Gitea token 是否可讀取指定 repository。](#verifygiteatoken) |
|
||||
| [verifyCommentToken](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L94) | [驗證 comment token 是否可用;未提供時回傳 skipped。](#verifycommenttoken) |
|
||||
| [fetchCodexModels](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L118) | [讀取本機 codex 認證檔並取得目前可用的模型 slug 清單。](#fetchcodexmodels) |
|
||||
| [verifyLLM](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L171) | [驗證目前環境是否有可用的 LLM CLI 與對應模型設定。](#verifyllm) |
|
||||
| [fetchLLMModels](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L118) | [呼叫 CLIProxyAPI 的模型清單端點並取得目前可用的模型 id 清單。](#fetchllmmodels) |
|
||||
| [verifyLLM](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L171) | [驗證目前環境是否有可用的 CLIProxyAPI 設定與對應模型。](#verifyllm) |
|
||||
| [runPreflight](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/preflight.js#L203) | [執行所有前置驗證流程,任一失敗即回傳 false。](#runpreflight) |
|
||||
| [parseBotReviewComment](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/resolve.js#L51) | [解析 bot 產生的 review comment,還原成 finding 欄位物件。](#parsebotreviewcomment) |
|
||||
| [groupConversations](https://gitea.jsc.idv.tw/actions/ai-code-review/blob/develop/src/resolve.js#L73) | [依檔案路徑與行號把 review comments 收斂成對話群組。](#groupconversations) |
|
||||
@@ -247,23 +246,9 @@ const result = getInsecureHttpsAgent();
|
||||
|
||||
預期結果:回傳對應資料、設定、字串或布林值。
|
||||
|
||||
### <a id="getllmclicommands"></a>getLLMCLICommands
|
||||
|
||||
取得目前支援的 LLM CLI 指令名稱清單。
|
||||
|
||||
檔案位置:`src/config.js` 第 100 行。
|
||||
|
||||
```js
|
||||
const result = getLLMCLICommands();
|
||||
```
|
||||
|
||||
使用情境:通常在本地資料處理或同步查詢時呼叫。
|
||||
|
||||
預期結果:回傳對應資料、設定、字串或布林值。
|
||||
|
||||
### <a id="getllmconfig"></a>getLLMConfig
|
||||
|
||||
依環境變數與 CLI 可用性解析目前可用的 LLM 提供者設定。
|
||||
依環境變數解析目前可用的 CLIProxyAPI 設定。
|
||||
|
||||
檔案位置:`src/config.js` 第 130 行。
|
||||
|
||||
@@ -823,7 +808,7 @@ const result = extractMeaningfulError(raw, limit);
|
||||
|
||||
### <a id="chat"></a>chat
|
||||
|
||||
呼叫可用的 AI 助理 CLI,並回傳文字回應。
|
||||
呼叫 CLIProxyAPI,並回傳文字回應。
|
||||
|
||||
檔案位置:`src/llm.js` 第 190 行。
|
||||
|
||||
@@ -1059,14 +1044,14 @@ const result = await verifyCommentToken(token);
|
||||
|
||||
預期結果:回傳驗證成功/失敗的結構化結果。
|
||||
|
||||
### <a id="fetchcodexmodels"></a>fetchCodexModels
|
||||
### <a id="fetchllmmodels"></a>fetchLLMModels
|
||||
|
||||
讀取本機 codex 認證檔並取得目前可用的模型 slug 清單。
|
||||
呼叫 CLIProxyAPI 的模型清單端點並取得目前可用的模型 id 清單。
|
||||
|
||||
檔案位置:`src/preflight.js` 第 118 行。
|
||||
|
||||
```js
|
||||
const result = await fetchCodexModels();
|
||||
const result = await fetchLLMModels();
|
||||
```
|
||||
|
||||
使用情境:通常在需要等待外部 I/O 或其他非同步回應時呼叫。
|
||||
@@ -1075,12 +1060,12 @@ const result = await fetchCodexModels();
|
||||
|
||||
### <a id="verifyllm"></a>verifyLLM
|
||||
|
||||
驗證目前環境是否有可用的 LLM CLI 與對應模型設定。
|
||||
驗證目前環境是否有可用的 CLIProxyAPI 設定與對應模型。
|
||||
|
||||
檔案位置:`src/preflight.js` 第 171 行。
|
||||
|
||||
```js
|
||||
const result = await verifyLLM(fetchCodexModelsFn);
|
||||
const result = await verifyLLM(fetchLLMModelsFn);
|
||||
```
|
||||
|
||||
使用情境:通常在需要等待外部 I/O 或其他非同步回應時呼叫。
|
||||
@@ -1464,4 +1449,3 @@ const result = formatUsageStatsLine(provider, model, usage, quota, rate);
|
||||
使用情境:通常在本地資料處理或同步查詢時呼叫。
|
||||
|
||||
預期結果:回傳對應資料、設定、字串或布林值。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user