Files
Arcrun/kbdb/wrangler.toml
T
uncle6me-web e788c52dd2 portal-auth P1(#24 #25):KBDB library filter 地基
- /entries 與 /entries/search 加 library 多值參數(逗號分隔);不帶=行為一字不變(向後相容)
- D1:COALESCE(json_extract(metadata_json,'$.library'),'general') IN (…)(≡ design §3.3 OR 形狀;
  未標記舊資料歸 general)
- semantic:Vectorize upsert metadata 加 library(寫入端正規化 general);查詢 filter $in 主路徑
  (官方文件+workers-types 4.20260702.1 核實支援,fan-out fallback 不需)
- 測試:library-filter.test.ts 11 項+既有 6 項全綠;tsc exit 0;本機 miniflare local D1 十案例實跑全過
- semantic 線上路徑(metadata index+reindex backfill)=部署清單,待雲端排練驗(本機無 Vectorize)
- cypher kbdb-proxy 透傳順延(P1 派工紅線只動 kbdb,tasks.md 已註)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 11:45:08 +08:00

41 lines
2.4 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name = "arcrun-kbdb"
main = "src/index.ts"
compatibility_date = "2025-02-19"
workers_dev = true
compatibility_flags = ["nodejs_compat"]
# KBDB Base — atomic universal table (SDD .agents/specs/arcrun/kbdb-base).
# Base needs D1 ONLY (free, no credit card). embed module adds Vectorize+AI bindings
# (optional, self-host opens it themselves). triplet is a separate repo.
[[d1_databases]]
binding = "DB"
database_name = "arcrun-kbdb"
database_id = "0c580910-e00b-4f8e-9c57-ac54ea52242f" # 官方 prod D1arcrun-kbdb);self-hosted deploy.ts 會注入用戶自己的 id 覆蓋
[vars]
ENVIRONMENT = "production"
# ── Optional embed module (issue #7 / SDD T2.4) ────────────────────────────────
# Base 預設不開(free-tier 友善)。self-host 開語義查詢時,deploy.ts 偵測 config kbdb_embed:true
# → 取消下面兩段註解(注入 active binding)並 `wrangler vectorize create arcrun-kbdb-embed
# --dimensions=768 --metric=cosine`bge-base-en-v1.5 = 768 維)。官方帳號同理由 deploy 注入。
# ⚠️ Arcrun#11:光建 index 不夠。要對 owner_id/entry_type/source 下 filterowner-scoped/類型-scoped 語意查詢),
# 必須另建 metadata index,否則帶過濾一律回 0 命中:
# wrangler vectorize create-metadata-index arcrun-kbdb-embed --property-name owner_id --type string
# wrangler vectorize create-metadata-index arcrun-kbdb-embed --property-name entry_type --type string
# wrangler vectorize create-metadata-index arcrun-kbdb-embed --property-name source --type string
# wrangler vectorize create-metadata-index arcrun-kbdb-embed --property-name library --type string
# libraryportal-auth P1「庫」filterupsert 端把未標記正規化成 'general',查詢走 $in
# metadata index 只收「建立後 upsert」的向量 → 既有向量須 `POST /embed/backfill {"reindex":true}` 重推
# (建 library index 後同樣要 reindex,否則舊向量帶 library filter 一律 0 命中)。
# deploy.ts 的 ensureVectorizeMetadataIndexes() 已把前三個 index 隨部署冪等建好;library 待補進該清單
# cli/ 屬 portal-auth P1 範圍外,見 portal-auth tasks.md 部署清單附註)。
# 沒有這兩個 binding 時,kbdb/src/embed.ts 的 embedEnabled() 回 false → 維持 LIKE keyword、API 不變。
#
# [[vectorize]]
# binding = "VECTORIZE"
# index_name = "arcrun-kbdb-embed"
#
# [ai]
# binding = "AI"