返回顶部
c

civil-judgment-taiwan-vectorstore台湾民事判决向量库

Ingest Taiwan civil court judgments (HTML or PDF) — exclusively covering Taiwan civil cases — into Qdrant with Ollama embeddings, preserving traceability, deduplication, and incremental updates.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
126
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

civil-judgment-taiwan-vectorstore

台灣民事判決 → 向量資料庫 (Qdrant) 匯入

範圍:僅限台灣民事法院判決(民事判決)。此技能將台灣民事案件(HTML PDF 檔案)匯入 Qdrant。所有解析、分塊和嵌入邏輯都位於 scripts/ingest.py 中 — 您的工作是執行該腳本,而非重新實作整個流程。



快速開始(請依序執行以下步驟)

步驟 1 — 啟動虛擬環境

bash
source {baseDir}/.venv/bin/activate

步驟 2 — 確認執行資料夾

使用者將提供執行資料夾的絕對路徑

範例:/path/to/output/judicialyuan/20260305_142030

確認該資料夾存在且包含 HTML 或 PDF 檔案:
bash
ls /archive/ | grep -E \.(html|pdf)$ | head -5

如果沒有 archive/.html 或 archive/.pdf 檔案 → 停止並告知使用者該資料夾沒有可匯入的資料。

步驟 3 — 執行匯入

全程使用絕對路徑 — 無需 cd:

bash
python3 {baseDir}/scripts/ingest.py \
--run-folder

該腳本會處理所有事項:前置檢查、自動建立集合(若 civilcasedoc / civilcasechunk 不存在則建立)、正規化、分塊、嵌入、Qdrant 更新、寫入清單與報告。

對同一資料夾重複執行相同指令始終安全 — 確定性 ID 意味著更新即覆寫。無需特殊的 --resume 標誌;只需再次執行相同指令即可。

步驟 4 — 檢查結果

成功輸出如下:

OK files=42 processed=42 skipped=0 errored=0 docpoints=42 chunkpoints=187
manifest=FOLDER>/ingestmanifest.jsonl
report=FOLDER>/ingestreport.md

閱讀報告(人類可讀的統計摘要):
bash
cat FOLDER>/ingestreport.md

如果有錯誤,請檢查清單(機器可讀,每檔案一行 JSON)以取得各檔案診斷資訊:
bash
grep -E status:(skipped|error|partial) FOLDER>/ingestmanifest.jsonl

步驟 5 — 向使用者報告

告知使用者:

  • - 已匯入多少文件(docpoints)
  • 已建立多少區塊(chunkpoints)
  • 是否有任何檔案被跳過或發生錯誤
  • 報告檔案的位置

完成。 除非使用者要求,否則不要繼續執行其他步驟。



禁止規則(重要)

  • - 禁止自行編寫 HTML 解析、分塊或嵌入程式碼。ingest.py 會處理所有這些。
  • 禁止隨意修改解析/分塊邏輯。僅在使用者明確要求改善 PDF/OCR 穩健性時,才更改標題偵測或區塊備援方案,並在重新執行大批次前先以小樣本驗證。
  • 禁止直接呼叫 Qdrant 或 Ollama API。腳本會處理這些。
  • 禁止對任何 HTTP 請求使用 verify=False 或跳過 SSL 驗證。
  • 禁止修改或刪除 archive/ 下的檔案。原始 HTML 是不可變的事實來源。
  • 禁止更改分塊預設值(--max-chars、--overlap-chars),除非使用者明確要求。

硬性限制

  • - 原始 HTML/PDF 是事實來源;絕不覆寫它。
  • 確定性:相同輸入 → 相同正規化文字 → 相同 SHA-256 → 相同 Qdrant 點 ID。可安全重新執行。
  • 可追溯性:每個 Qdrant 點都帶有 docurl + localpath。
  • 批次更新(每批次 ≤ 64 點)以避免 Qdrant 32MB 負載限制。
  • parser_version 存在於每個點的中繼資料中。目前:v3.5-sentence-boundary。

疑難排解

PREFLIGHT_FAILED: Qdrant not reachable

Qdrant 已關閉或在預設/設定的 URL 上無法連線。

bash

檢查 Qdrant 是否正在執行


curl -s http://localhost:6333/collections | head -1

如果未執行,請啟動它(或詢問使用者)

PREFLIGHT_FAILED: Ollama not reachable

bash

檢查 Ollama


curl -s http://localhost:11434/api/tags | head -5

PREFLIGHT_FAILED: Ollama model missing: bge-m3:latest

bash
ollama pull bge-m3:latest

然後重新執行步驟 3。

PREFLIGHT_FAILED: No archive/.html or archive/.pdf found

執行資料夾存在但沒有存檔的詳細頁面。檢查:

  • - 這是正確的執行資料夾嗎?

輸出顯示 skipped > 0 或 errored > 0

檢查 ingest_manifest.jsonl 以取得各檔案詳細資訊:
bash
grep -E status:(skipped|error|partial) FOLDER>/ingestmanifest.jsonl

清單狀態含義操作
ok文件 + 所有區塊已匯入
partial
文件已更新,但某些章節區塊嵌入失敗 | 檢查 Ollama 穩定性;可安全重新執行 | | skipped | 文件層級嵌入失敗 — 此文件無任何內容更新 | 檢查 Ollama;可安全重新執行 | | error | HTML 讀取/解析失敗 | 檢查 HTML 檔案是否損毀 |

重新執行始終安全 — 使用完全相同的指令。無需特殊標誌;確定性 ID → 更新/覆寫。

覆寫服務端點

bash

透過環境變數


OLLAMAURL=http://localhost:11434 QDRANTURL=http://localhost:6333 \
python3 scripts/ingest.py --run-folder ...

透過 CLI 標誌(優先於環境變數)

python3 scripts/ingest.py --run-folder ... \ --ollama http://localhost:11434 --qdrant http://localhost:6333

預設端點:

服務預設值環境變數覆寫
Ollamahttp://localhost:11434$OLLAMAURL
Qdrant
http://localhost:6333 | $QDRANTURL |

先以小批次測試

bash
python3 scripts/ingest.py --run-folder ... --limit 5



輸入資料夾結構(預期)

/
archive/
fjuddetail001.html ← HTML 輸入
fjuddetail002.html
fjuddetail003.pdf ← PDF 輸入(也支援)
fintdetail001.html (如果 system=both)
results_fjud.jsonl (可選)
results_fint.jsonl (可選)

腳本會自動發現所有 archive/.html 和 archive/.pdf 檔案(按檔名排序)。HTML 和 PDF 檔案可以在同一執行資料夾中共存。

v1 限制:system 中繼資料欄位目前硬編碼為 FJUD。如果執行資料夾同時包含 FJUD 和 FINT 檔案,FINT 檔案會被匯入但錯誤標記為 FJUD。這不影響分塊或嵌入 — 僅影響結果 Qdrant 點上的 system 中繼資料欄位。



CLI 參考

python3 scripts/ingest.py --run-folder [options]

標誌預設值說明
--run-folder(必要)輸入資料夾的路徑
--ollama
$OLLAMA_URL 或 http://localhost:11434 | Ollama 端點 | | --qdrant | $QDRANT_URL 或 http://localhost:6333 | Qdrant 端點 | | --embed-model | bge-m3:latest | Ollama 嵌入模型 | | --vector-size | 1024 | 向量

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 civil-judgment-taiwan-vectorstore-1775942602 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 civil-judgment-taiwan-vectorstore-1775942602 技能

通过命令行安装

skillhub install civil-judgment-taiwan-vectorstore-1775942602

下载

⬇ 下载 civil-judgment-taiwan-vectorstore v1.0.0(免费)

文件大小: 35.02 KB | 发布时间: 2026-4-12 09:23

v1.0.0 最新 2026-4-12 09:23
Initial release for Taiwan civil court judgment ingestion to Qdrant

- Supports ingestion of Taiwan civil court judgments (HTML and PDF) into Qdrant with Ollama embeddings.
- Ensures traceability, deduplication, and safe incremental updates.
- Enforces strict process: raw files never overwritten, deterministic IDs, and robust pre-flight checks.
- Provides user-friendly reporting on processed, skipped, and errored files.
- Explicit DO NOT rules to avoid accidental misuse or logic modifications.
- Troubleshooting and testing instructions included for fast onboarding.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部