核心防禦系統模組 - Sovereign Heuristic Intelligence & Enterprise Logic Defense
Core 模組是 SHIELD 的核心引擎,包含主權 AI 防禦系統的所有核心功能。
core/
├── app.py # 主應用程式 (Streamlit UI)
├── llm.py # LLM 核心功能與推理引擎
├── llm_utils.py # LLM 工具函數
├── search.py # 企業知識搜尋引擎
├── scrape.py # 網頁爬蟲與資料擷取
├── health.py # 系統健康檢查
├── init_ontology.py # 防禦知識本體初始化
├── config.py # 配置文件
├── requirements.txt # Python 依賴套件
└── pageindex/ # 頁面索引子模組
├── __init__.py
├── page_index.py
├── page_index_md.py
├── batch_preprocess.py
├── client.py
├── retrieve.py
├── utils.py
└── config.yaml
cd core
pip install -r requirements.txt
需要設置以下環境變數:
export GOOGLE_API_KEY="your-gemini-api-key"
streamlit run app.py
或者是想要指定特定的 PORT (EX: 8000) 的話就是這樣
python -m streamlit run app.py --server.port 8000 --server.address 0.0.0.0
應用程式將在 http://localhost:8501 或者 http://localhost:8000 啟動。
Core 模組採用 Monorepo 架構,會引用上層 shared/ 目錄中的資源:
../shared/data/../shared/assets/主要配置項在 config.py 中,包括:
獨立測試知識本體建置:
python init_ontology.py
主要依賴(詳見 requirements.txt):
streamlit - Web UI 框架google-genai - Gemini APInetworkx - 圖論與知識圖譜pandas - 資料處理pyvis - 網絡可視化PyMuPDF (fitz) - PDF 處理data/ 和 assets/ 的引用已更新為相對於 Monorepo 根目錄from config import ...)