mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-09-20 17:08:18 +00:00
docs: fix startup flow to match backend-config-managed architecture
This commit is contained in:
@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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 # 模型名称
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user