mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-10-15 12:15:32 +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
|
```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
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
@ -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 # 模型名称
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user