docs: fix startup flow to match backend-config-managed architecture

This commit is contained in:
root
2026-04-14 16:41:22 +08:00
parent 8ed5b9eeb2
commit e7262c0814
4 changed files with 28 additions and 24 deletions

View File

@ -173,7 +173,8 @@ body = {} # No parameters
```python ```python
{ {
"api_key": str, # API Key "api_key": str, # API Key
"base_url": str # API Base URL "base_url": str, # API Base URL
"model": str # Model name
} }
``` ```

View File

@ -123,19 +123,20 @@ MessageHistory displays
```python ```python
# trulymem_entry.py # trulymem_entry.py
def main(): def main():
# Config file saved in application root # Config path (~/.trulymem/config.json or project directory)
config_file = application_path / "config.json" CONFIG_PATH = Path.home() / ".trulymem" / "config.json"
DB_PATH = Path.home() / ".trulymem" / "graph_memory.db"
# Load config # Create backend (config managed by backend)
config_service = ConfigService(config_file=config_file) backend_server = BackendServer(
config = config_service.get_config() db_path=str(DB_PATH),
use_embedded_db=True,
config_file=str(CONFIG_PATH)
)
backend_server.start() # Auto loads config
# Create backend # Create UI (communicates via BackendClient)
backend_server = BackendServer(db_path="graph_memory.db", use_embedded_db=True) app = GraphMemoryApp(backend_server=backend_server, config_file=str(CONFIG_PATH))
backend_server.start(api_key=config.api_key, base_url=config.base_url)
# Create UI
app = GraphMemoryApp(backend_server=backend_server, config_service=config_service)
app.run() app.run()
backend_server.shutdown() backend_server.shutdown()

View File

@ -179,7 +179,8 @@ body = {} # 无参数
```python ```python
{ {
"api_key": str, # API Key "api_key": str, # API Key
"base_url": str # API Base URL "base_url": str, # API Base URL
"model": str # 模型名称
} }
``` ```

View File

@ -123,19 +123,20 @@ MessageHistory 显示
```python ```python
# trulymem_entry.py # trulymem_entry.py
def main(): def main():
# 配置文件保存在应用根目录 # 配置文件路径 (~/.trulymem/config.json 或项目目录)
config_file = application_path / "config.json" CONFIG_PATH = Path.home() / ".trulymem" / "config.json"
DB_PATH = Path.home() / ".trulymem" / "graph_memory.db"
# 加载配置 # 创建后端(配置由后端管理)
config_service = ConfigService(config_file=config_file) backend_server = BackendServer(
config = config_service.get_config() db_path=str(DB_PATH),
use_embedded_db=True,
config_file=str(CONFIG_PATH)
)
backend_server.start() # 自动加载配置
# 创建后端 # 创建UI(通过 BackendClient 通信)
backend_server = BackendServer(db_path="graph_memory.db", use_embedded_db=True) app = GraphMemoryApp(backend_server=backend_server, config_file=str(CONFIG_PATH))
backend_server.start(api_key=config.api_key, base_url=config.base_url)
# 创建UI
app = GraphMemoryApp(backend_server=backend_server, config_service=config_service)
app.run() app.run()
backend_server.shutdown() backend_server.shutdown()