Spaces:
Running
Running
fix: Import .md
Browse files- README.md +3 -3
- doc/ARCHITECTURE.md +18 -20
- ui/components/modals.py +17 -15
README.md
CHANGED
|
@@ -168,11 +168,11 @@ python app.py
|
|
| 168 |
|
| 169 |
Explore the technical details behind LifeFlow AI:
|
| 170 |
|
| 171 |
-
- [**🏗️ Architecture Design**](doc/ARCHITECTURE.md)
|
| 172 |
> Deep dive into the **"Dual-Brain" system**, **Context Offloading**, and **Exclusive MCP Channels**.
|
| 173 |
|
| 174 |
-
- [**🤖 The Agent Team**](doc/AGENTS.md)
|
| 175 |
> Detailed roster of our 6 specialized agents, their models, tools, and prompt strategies.
|
| 176 |
|
| 177 |
-
- [**🔧 Troubleshooting Guide**](doc/TROUBLESHOOTING.md)
|
| 178 |
> Solutions for common API errors (Google/OpenWeather), JSON parsing issues, and Docker setup.
|
|
|
|
| 168 |
|
| 169 |
Explore the technical details behind LifeFlow AI:
|
| 170 |
|
| 171 |
+
- [**🏗️ Architecture Design**](https://huggingface.co/spaces/MCP-1st-Birthday/LifeFlow-AI/blob/main/doc/ARCHITECTURE.md)
|
| 172 |
> Deep dive into the **"Dual-Brain" system**, **Context Offloading**, and **Exclusive MCP Channels**.
|
| 173 |
|
| 174 |
+
- [**🤖 The Agent Team**](https://huggingface.co/spaces/MCP-1st-Birthday/LifeFlow-AI/blob/main/doc/AGENTS.md)
|
| 175 |
> Detailed roster of our 6 specialized agents, their models, tools, and prompt strategies.
|
| 176 |
|
| 177 |
+
- [**🔧 Troubleshooting Guide**](https://huggingface.co/spaces/MCP-1st-Birthday/LifeFlow-AI/blob/main/doc/TROUBLESHOOTING.md)
|
| 178 |
> Solutions for common API errors (Google/OpenWeather), JSON parsing issues, and Docker setup.
|
doc/ARCHITECTURE.md
CHANGED
|
@@ -72,29 +72,27 @@ The "Glue" connecting these isolated environments is the **Database Reference ID
|
|
| 72 |
|
| 73 |
This architecture ensures that while **Tools are Private** (security & accuracy), **Data is Global** (accessibility).
|
| 74 |
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
subgraph Storage ["💾 Unified Storage Layer"]
|
| 84 |
-
DB[(POI Repository)]
|
| 85 |
-
end
|
| 86 |
|
| 87 |
-
%% Data Flow
|
| 88 |
-
A -->|Write Data| DB
|
| 89 |
-
B <-->|Read/Write Data| DB
|
| 90 |
-
C <-->|Read/Write Data| DB
|
| 91 |
|
| 92 |
-
%% ID Passing
|
| 93 |
-
A -.->|Pass Ref ID| B
|
| 94 |
-
B -.->|Pass Ref ID| C
|
| 95 |
-
|
| 96 |
-
%% Styling
|
| 97 |
-
style DB fill:#f9f,stroke:#333,stroke-width:2px
|
| 98 |
```
|
| 99 |
|
| 100 |
## 🛠️ Tech Stack & Compon**ents**
|
|
|
|
| 72 |
|
| 73 |
This architecture ensures that while **Tools are Private** (security & accuracy), **Data is Global** (accessibility).
|
| 74 |
|
| 75 |
+
```text
|
| 76 |
+
+-----------------------------+ +-------------------------+
|
| 77 |
+
| ⚡ EXECUTION CHANNELS | | 💾 UNIFIED STORAGE |
|
| 78 |
+
+-----------------------------+ +-------------------------+
|
| 79 |
+
|
| 80 |
+
(Write Data) +-------------------------+
|
| 81 |
+
1. [ Channel A: SCOUT ] ------------------------>| |
|
| 82 |
+
| | |
|
| 83 |
+
| (Pass Ref ID: "ref_123") | |
|
| 84 |
+
v | |
|
| 85 |
+
| POI REPOSITORY |
|
| 86 |
+
2. [ Channel B: OPTIMIZER ] <----(Read/Write)--->| (SQLite) |
|
| 87 |
+
| | |
|
| 88 |
+
| (Pass Ref ID: "ref_456") | |
|
| 89 |
+
v | |
|
| 90 |
+
| |
|
| 91 |
+
3. [ Channel C: NAVIGATOR ] <----(Read/Write)--->| |
|
| 92 |
+
+------------------------ +
|
| 93 |
|
|
|
|
|
|
|
|
|
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
```
|
| 97 |
|
| 98 |
## 🛠️ Tech Stack & Compon**ents**
|
ui/components/modals.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import gradio as gr
|
| 3 |
from config import MODEL_OPTIONS, DEFAULT_PROVIDER, DEFAULT_MODEL, GROQ_FAST_MODEL_OPTIONS
|
| 4 |
from config import BASE_DIR
|
|
|
|
| 5 |
|
| 6 |
def create_validated_input(label, placeholder, type="password"):
|
| 7 |
"""
|
|
@@ -104,7 +105,7 @@ def create_settings_modal():
|
|
| 104 |
def create_doc_modal():
|
| 105 |
"""
|
| 106 |
創建文檔模態框
|
| 107 |
-
功能:自動讀取 README.md
|
| 108 |
"""
|
| 109 |
|
| 110 |
readme_path = BASE_DIR / "README.md"
|
|
@@ -115,18 +116,20 @@ def create_doc_modal():
|
|
| 115 |
with open(readme_path, "r", encoding="utf-8") as f:
|
| 116 |
raw_content = f.read()
|
| 117 |
|
| 118 |
-
# 🔥🔥🔥 [
|
| 119 |
-
#
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
| 130 |
|
| 131 |
else:
|
| 132 |
doc_content = "## ⚠️ Documentation Not Found"
|
|
@@ -134,14 +137,13 @@ def create_doc_modal():
|
|
| 134 |
except Exception as e:
|
| 135 |
doc_content = f"## ❌ Error Loading Documentation\n\n{str(e)}"
|
| 136 |
|
| 137 |
-
# ... (後面的 UI 構建代碼保持不變) ...
|
| 138 |
with gr.Group(visible=False, elem_classes="modal-overlay", elem_id="doc-modal") as doc_modal:
|
| 139 |
with gr.Group(elem_classes="modal-box"):
|
| 140 |
with gr.Row(elem_classes="modal-header"):
|
| 141 |
gr.Markdown("### 📖 Documentation", elem_classes="modal-title")
|
| 142 |
|
| 143 |
with gr.Column(elem_classes="modal-content"):
|
| 144 |
-
gr.Markdown(doc_content)
|
| 145 |
|
| 146 |
with gr.Row(elem_classes="modal-footer"):
|
| 147 |
close_doc_btn = gr.Button("Close", variant="secondary", elem_classes="btn-cancel")
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from config import MODEL_OPTIONS, DEFAULT_PROVIDER, DEFAULT_MODEL, GROQ_FAST_MODEL_OPTIONS
|
| 4 |
from config import BASE_DIR
|
| 5 |
+
import re
|
| 6 |
|
| 7 |
def create_validated_input(label, placeholder, type="password"):
|
| 8 |
"""
|
|
|
|
| 105 |
def create_doc_modal():
|
| 106 |
"""
|
| 107 |
創建文檔模態框
|
| 108 |
+
功能:自動讀取 README.md 並【強力過濾】YAML Front Matter
|
| 109 |
"""
|
| 110 |
|
| 111 |
readme_path = BASE_DIR / "README.md"
|
|
|
|
| 116 |
with open(readme_path, "r", encoding="utf-8") as f:
|
| 117 |
raw_content = f.read()
|
| 118 |
|
| 119 |
+
# 🔥🔥🔥 [Regex 強力修正] 🔥🔥🔥
|
| 120 |
+
# 說明:
|
| 121 |
+
# ^---\s*\n -> 匹配開頭的 --- (允許後面有空白) 和 換行
|
| 122 |
+
# .*? -> 非貪婪匹配中間的所有內容 (包含換行)
|
| 123 |
+
# \n---\s*\n? -> 匹配結尾的換行 + --- + 結尾可能有的換行
|
| 124 |
+
# re.DOTALL -> 讓 . 可以匹配換行符號
|
| 125 |
+
# re.MULTILINE-> 讓 ^ 可以匹配檔案開頭
|
| 126 |
+
|
| 127 |
+
yaml_pattern = r"^---\s*\n.*?\n---\s*\n?"
|
| 128 |
+
|
| 129 |
+
# 使用 sub 將匹配到的 YAML 區塊替換為空字串
|
| 130 |
+
clean_content = re.sub(yaml_pattern, "", raw_content, count=1, flags=re.DOTALL | re.MULTILINE)
|
| 131 |
+
|
| 132 |
+
doc_content = clean_content.strip()
|
| 133 |
|
| 134 |
else:
|
| 135 |
doc_content = "## ⚠️ Documentation Not Found"
|
|
|
|
| 137 |
except Exception as e:
|
| 138 |
doc_content = f"## ❌ Error Loading Documentation\n\n{str(e)}"
|
| 139 |
|
|
|
|
| 140 |
with gr.Group(visible=False, elem_classes="modal-overlay", elem_id="doc-modal") as doc_modal:
|
| 141 |
with gr.Group(elem_classes="modal-box"):
|
| 142 |
with gr.Row(elem_classes="modal-header"):
|
| 143 |
gr.Markdown("### 📖 Documentation", elem_classes="modal-title")
|
| 144 |
|
| 145 |
with gr.Column(elem_classes="modal-content"):
|
| 146 |
+
gr.Markdown(doc_content)
|
| 147 |
|
| 148 |
with gr.Row(elem_classes="modal-footer"):
|
| 149 |
close_doc_btn = gr.Button("Close", variant="secondary", elem_classes="btn-cancel")
|