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 558eee4f58
commit 8d15624b56
4 changed files with 28 additions and 24 deletions

View File

@ -173,7 +173,8 @@ body = {} # No parameters
```python
{
"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
# trulymem_entry.py
def main():
# Config file saved in application root
config_file = application_path / "config.json"
# Config path (~/.trulymem/config.json or project directory)
CONFIG_PATH = Path.home() / ".trulymem" / "config.json"
DB_PATH = Path.home() / ".trulymem" / "graph_memory.db"
# Load config
config_service = ConfigService(config_file=config_file)
config = config_service.get_config()
# Create backend (config managed by backend)
backend_server = BackendServer(
db_path=str(DB_PATH),
use_embedded_db=True,
config_file=str(CONFIG_PATH)
)
backend_server.start() # Auto loads config
# Create backend
backend_server = BackendServer(db_path="graph_memory.db", use_embedded_db=True)
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)
# Create UI (communicates via BackendClient)
app = GraphMemoryApp(backend_server=backend_server, config_file=str(CONFIG_PATH))
app.run()
backend_server.shutdown()

View File

@ -179,7 +179,8 @@ body = {} # 无参数
```python
{
"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
# trulymem_entry.py
def main():
# 配置文件保存在应用根目录
config_file = application_path / "config.json"
# 配置文件路径 (~/.trulymem/config.json 或项目目录)
CONFIG_PATH = Path.home() / ".trulymem" / "config.json"
DB_PATH = Path.home() / ".trulymem" / "graph_memory.db"
# 加载配置
config_service = ConfigService(config_file=config_file)
config = config_service.get_config()
# 创建后端(配置由后端管理)
backend_server = BackendServer(
db_path=str(DB_PATH),
use_embedded_db=True,
config_file=str(CONFIG_PATH)
)
backend_server.start() # 自动加载配置
# 创建后端
backend_server = BackendServer(db_path="graph_memory.db", use_embedded_db=True)
backend_server.start(api_key=config.api_key, base_url=config.base_url)
# 创建UI
app = GraphMemoryApp(backend_server=backend_server, config_service=config_service)
# 创建UI通过 BackendClient 通信)
app = GraphMemoryApp(backend_server=backend_server, config_file=str(CONFIG_PATH))
app.run()
backend_server.shutdown()