更正 README 過時的 AI_PROVIDER 說法,行號連結重算並加上檢查腳本 - #17
Merged
Merged
Conversation
「把 AI_PROVIDER 改成 0g 就能整支切過去」在 #16 之後是反的 —— 0g 已經是預設。 改成說明兩者預設都指向 0G Compute,以及為什麼不能是 OpenAI(對打的 agent 不在 enclave 裡的話,「整場都是同一位」這個主張就不成立)。 行號連結有三個在 #16 之後指到不相干的地方(範圍還在檔案內,所以肉眼看不出來): functions/api/og/shard.js#L62-L84 → #L85-L107 (原本落在註解中段) functions/api/agent.js#L173-L256 → #L188-L291 (evidence 那段把它往後推) public/js/ai.js#L16-L65 → #L16-L68 另外 _shared.js 的供應商工廠拆成兩個連結,分別指 providerConfig 與 ogComputeConfig。 這種漂移一天內發生兩次了,所以加 scripts/check-links.mjs(npm run check:links)。 它不驗「行號是不是原本想指的東西」—— 那需要人判斷 —— 只驗一件機械可查的事: 起始行要是函式或註解區塊的開頭、結束行要是收尾。位移之後這兩個條件幾乎必然被破壞。 現在 15 個連結全過。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NBxaWtzqEX3i8NvoZEeq3
There was a problem hiding this comment.
🟡 Changes recommended
新增的檢查腳本在起始行號無效時可能直接拋錯崩潰,且 README 仍有一列對敵方 agent 預設供應商的描述與實際行為不一致。
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
這個 PR 更新 README 中關於 AI_PROVIDER/0G Compute 預設行為的說明、修正多個行號連結的範圍,並新增一個腳本用來自動檢查 README 的行號連結是否因為程式碼位移而漂移失效。
Changes:
- 更正 README 對
AI_PROVIDER與 0G Compute/OpenAI 預設指向的敘述,並重算多個行號連結範圍。 - 新增
scripts/check-links.mjs,提供npm run check:links檢查 README 行號連結是否落在合理的「區塊起訖」位置。 - 在
package.json中加入check:linksscript。
File summaries
| File | Description |
|---|---|
| scripts/check-links.mjs | 新增 README 行號連結漂移檢查腳本。 |
| README.md | 修正 AI_PROVIDER 說法與行號連結範圍,並補上檢查指令說明。 |
| package.json | 新增 check:links npm script。 |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+42
to
+52
| const a = Number(aStr); | ||
| const b = Number(bStr); | ||
| if (b > lines.length) { | ||
| console.log(`❌ ${key} 檔案只有 ${lines.length} 行`); | ||
| bad += 1; | ||
| continue; | ||
| } | ||
|
|
||
| const head = lines[a - 1].trim(); | ||
| const tail = lines[b - 1].trim(); | ||
| const ok = START_OK.test(head) && END_OK.test(tail); |
| | **0G Chain**<br>鏈上回驗 | **這是整個專案的重點**:按了按鈕、錢包沒報錯,不代表資料真的在鏈上。所以再用 `eth_getTransactionByHash` 把交易讀回來、反解 calldata、跟本地碎片逐欄比對,四項全對才打勾。 | [`functions/api/og/verify.js#L19-L47`](https://github.com/ConsssLab/web/blob/main/functions/api/og/verify.js#L19-L47) · [`functions/api/og/verify.js#L49-L104`](https://github.com/ConsssLab/web/blob/main/functions/api/og/verify.js#L49-L104) | | ||
| | **0G Chain**<br>鏈況與網路切換 | 標題頁即時顯示 Galileo 區塊高度;chainId **從鏈上實際讀回來**校準而不是寫死(0G 換過 chain ID 16601→16602,寫死會讓切鏈整個失敗)。 | [`functions/api/og/status.js#L59-L157`](https://github.com/ConsssLab/web/blob/main/functions/api/og/status.js#L59-L157) · [`public/js/og.js#L167-L220`](https://github.com/ConsssLab/web/blob/main/public/js/og.js#L167-L220) | | ||
| | — **敵方 AI agent**<br>(OpenAI,非 0G) | 對戰時每回合都要叫一次,需要低延遲,所以另外走 OpenAI。模型輸出一律當不可信資料重新過濾。 | [`functions/api/agent.js#L173-L256`](https://github.com/ConsssLab/web/blob/main/functions/api/agent.js#L173-L256) · [`public/js/ai.js#L16-L65`](https://github.com/ConsssLab/web/blob/main/public/js/ai.js#L16-L65) | | ||
| | — **敵方 AI agent**<br>(OpenAI,非 0G) | 對戰時每回合都要叫一次,需要低延遲,所以另外走 OpenAI。模型輸出一律當不可信資料重新過濾。 | [`functions/api/agent.js#L188-L291`](https://github.com/ConsssLab/web/blob/main/functions/api/agent.js#L188-L291) · [`public/js/ai.js#L16-L68`](https://github.com/ConsssLab/web/blob/main/public/js/ai.js#L16-L68) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
說法反了
給評審那張表寫著「把
AI_PROVIDER改成0g就能整支切過去」—— 在 #16 之後這是反的,0g已經是預設。改成說明兩者預設都指向 0G Compute,以及為什麼不能是 OpenAI:對打的 agent 不在 enclave 裡的話,「整場都是同一位」這個主張就不成立。三個行號連結指到不相干的地方
範圍還在檔案內,所以肉眼看不出來:
shard.js#L62-L84#L85-L107agent.js#L173-L256#L188-L291ai.js#L16-L65#L16-L68另外把
_shared.js的供應商工廠拆成兩個連結,分別指providerConfig與ogComputeConfig。加了檢查腳本
這種漂移一天內發生兩次了(上一次「賽道二 indexer 唯讀查詢」點下去落在兩個無關的小工具函式上),所以加
scripts/check-links.mjs:它不驗「行號是不是原本想指的東西」—— 那需要人判斷 —— 只驗一件機械可查的事:起始行要是函式或註解區塊的開頭、結束行要是收尾。行號位移之後這兩個條件幾乎必然被破壞,所以抓得到。
🤖 Generated with Claude Code
https://claude.ai/code/session_015NBxaWtzqEX3i8NvoZEeq3
Generated by Claude Code