3d21bf0725
## 這條與 t195 直接相關
新 ingest 鏈(rag_ingest_card/rag_ingest_direct,就是我今天在修的收卡鏈)
寫的 metadata.source 是 **kb://<path>**,但 main 的 portal 溯源只認 gitea://
⇒ 卡片上傳成功後,**溯源連結一律失效**。
原修補在 fix/portal-source-scheme-t21(07-24),一個月沒併回 main。
該分支的檔案 console-ui/src/portal-ui.ts 已被重構搬走(UI 搬 CF Pages),
⇒ 不能直接 merge,**移植邏輯到現行的 console-ui/public/portal/index.html**。
## 三種 scheme 的正解(照原分支設計)
· gitea://<path> 舊 rag_ingest v2 → {base}/<path>,行為一字不變(不回歸)
· gitea:<org/repo>@<path> km-wiki-ingest 實形 → {base}/<org/repo>/src/branch/main/<path>
· kb://<path> 新 ingest 鏈實形 → **回空字串=維持純文字,不造死鏈**
(雲端沒有對應網頁;另給 srcLocalPath() 取本地相對路徑顯示)
## 實測四情境(抽出函式跑 node)
gitea://docs/a b.md#3 → https://…/base/docs/a%20b.md ✅ 錨點捨棄+編碼
gitea:Leo/kb@notes/x.md#seg01 → https://…/base/Leo/kb/src/branch/main/notes/x.md ✅
kb://wiki/cards/policy.md → ✅ 不造死鏈
srcLocalPath(kb://…#seg02) → wiki/cards/policy.md ✅
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>