neuro-simulator 0.1.3__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- neuro_simulator/__init__.py +1 -10
- neuro_simulator/agent/__init__.py +1 -8
- neuro_simulator/agent/base.py +43 -0
- neuro_simulator/agent/core.py +111 -397
- neuro_simulator/agent/factory.py +30 -0
- neuro_simulator/agent/llm.py +34 -31
- neuro_simulator/agent/memory/__init__.py +1 -4
- neuro_simulator/agent/memory/manager.py +61 -203
- neuro_simulator/agent/tools/__init__.py +1 -4
- neuro_simulator/agent/tools/core.py +8 -18
- neuro_simulator/api/__init__.py +1 -0
- neuro_simulator/api/agent.py +163 -0
- neuro_simulator/api/stream.py +55 -0
- neuro_simulator/api/system.py +90 -0
- neuro_simulator/cli.py +53 -142
- neuro_simulator/core/__init__.py +1 -0
- neuro_simulator/core/agent_factory.py +52 -0
- neuro_simulator/core/agent_interface.py +91 -0
- neuro_simulator/core/application.py +278 -0
- neuro_simulator/services/__init__.py +1 -0
- neuro_simulator/{chatbot.py → services/audience.py} +24 -24
- neuro_simulator/{audio_synthesis.py → services/audio.py} +18 -15
- neuro_simulator/services/builtin.py +87 -0
- neuro_simulator/services/letta.py +206 -0
- neuro_simulator/{stream_manager.py → services/stream.py} +39 -47
- neuro_simulator/utils/__init__.py +1 -0
- neuro_simulator/utils/logging.py +90 -0
- neuro_simulator/utils/process.py +67 -0
- neuro_simulator/{stream_chat.py → utils/queue.py} +17 -4
- neuro_simulator/utils/state.py +14 -0
- neuro_simulator/{websocket_manager.py → utils/websocket.py} +18 -14
- {neuro_simulator-0.1.3.dist-info → neuro_simulator-0.2.0.dist-info}/METADATA +176 -176
- neuro_simulator-0.2.0.dist-info/RECORD +37 -0
- neuro_simulator/agent/api.py +0 -737
- neuro_simulator/agent/memory.py +0 -137
- neuro_simulator/agent/tools.py +0 -69
- neuro_simulator/builtin_agent.py +0 -83
- neuro_simulator/config.yaml.example +0 -157
- neuro_simulator/letta.py +0 -164
- neuro_simulator/log_handler.py +0 -43
- neuro_simulator/main.py +0 -673
- neuro_simulator/media/neuro_start.mp4 +0 -0
- neuro_simulator/process_manager.py +0 -70
- neuro_simulator/shared_state.py +0 -11
- neuro_simulator-0.1.3.dist-info/RECORD +0 -31
- /neuro_simulator/{config.py → core/config.py} +0 -0
- {neuro_simulator-0.1.3.dist-info → neuro_simulator-0.2.0.dist-info}/WHEEL +0 -0
- {neuro_simulator-0.1.3.dist-info → neuro_simulator-0.2.0.dist-info}/entry_points.txt +0 -0
- {neuro_simulator-0.1.3.dist-info → neuro_simulator-0.2.0.dist-info}/top_level.txt +0 -0
@@ -1,45 +1,49 @@
|
|
1
|
-
#
|
2
|
-
from fastapi import WebSocket
|
3
|
-
from collections import deque
|
1
|
+
# neuro_simulator/utils/websocket.py
|
4
2
|
import asyncio
|
5
3
|
import json
|
6
|
-
|
4
|
+
import logging
|
5
|
+
from collections import deque
|
6
|
+
|
7
|
+
from fastapi import WebSocket
|
8
|
+
from starlette.websockets import WebSocketState
|
9
|
+
|
10
|
+
logger = logging.getLogger(__name__.replace("neuro_simulator", "server", 1))
|
7
11
|
|
8
12
|
class WebSocketManager:
|
9
|
-
"""
|
13
|
+
"""Manages all active WebSocket connections and provides broadcasting capabilities."""
|
10
14
|
def __init__(self):
|
11
15
|
self.active_connections: deque[WebSocket] = deque()
|
12
|
-
|
16
|
+
logger.info("WebSocketManager initialized.")
|
13
17
|
|
14
18
|
async def connect(self, websocket: WebSocket):
|
15
19
|
await websocket.accept()
|
16
20
|
self.active_connections.append(websocket)
|
17
|
-
|
21
|
+
logger.info(f"WebSocket client connected. Total connections: {len(self.active_connections)}")
|
18
22
|
|
19
23
|
def disconnect(self, websocket: WebSocket):
|
20
24
|
try:
|
21
25
|
if websocket in self.active_connections:
|
22
26
|
self.active_connections.remove(websocket)
|
23
|
-
|
27
|
+
logger.info(f"WebSocket client disconnected. Total connections: {len(self.active_connections)}")
|
24
28
|
except Exception as e:
|
25
|
-
|
29
|
+
logger.error(f"Error during WebSocket disconnect: {e}")
|
26
30
|
|
27
31
|
async def send_personal_message(self, message: dict, websocket: WebSocket):
|
28
32
|
if websocket.client_state == WebSocketState.CONNECTED:
|
29
33
|
try:
|
30
34
|
await websocket.send_json(message)
|
31
35
|
except Exception as e:
|
32
|
-
|
36
|
+
logger.warning(f"Could not send personal message, client likely disconnected: {e}")
|
33
37
|
self.disconnect(websocket)
|
34
38
|
|
35
39
|
async def broadcast(self, message: dict):
|
36
40
|
disconnected_sockets = []
|
37
|
-
for connection in list(self.active_connections):
|
41
|
+
for connection in list(self.active_connections):
|
38
42
|
if connection.client_state == WebSocketState.CONNECTED:
|
39
43
|
try:
|
40
44
|
await connection.send_json(message)
|
41
45
|
except Exception as e:
|
42
|
-
|
46
|
+
logger.warning(f"Could not broadcast message to client {connection}, it may have disconnected: {e}")
|
43
47
|
disconnected_sockets.append(connection)
|
44
48
|
else:
|
45
49
|
disconnected_sockets.append(connection)
|
@@ -47,5 +51,5 @@ class WebSocketManager:
|
|
47
51
|
for disconnected_socket in disconnected_sockets:
|
48
52
|
self.disconnect(disconnected_socket)
|
49
53
|
|
50
|
-
#
|
51
|
-
connection_manager = WebSocketManager()
|
54
|
+
# Global singleton instance
|
55
|
+
connection_manager = WebSocketManager()
|
@@ -1,176 +1,176 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: neuro_simulator
|
3
|
-
Version: 0.
|
4
|
-
Summary: Neuro Simulator Server
|
5
|
-
Author-email: Moha-Master <hongkongreporter@outlook.com>
|
6
|
-
License-Expression: MIT
|
7
|
-
Project-URL: Homepage, https://github.com/Moha-Master/neuro-simulator
|
8
|
-
Project-URL: Repository, https://github.com/Moha-Master/neuro-simulator
|
9
|
-
Project-URL: Issues, https://github.com/Moha-Master/neuro-simulator/issues
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
11
|
-
Classifier: Intended Audience :: Developers
|
12
|
-
Classifier: Operating System :: OS Independent
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
19
|
-
Requires-Python: >=3.8
|
20
|
-
Description-Content-Type: text/markdown
|
21
|
-
Requires-Dist: fastapi
|
22
|
-
Requires-Dist: uvicorn
|
23
|
-
Requires-Dist: google-genai
|
24
|
-
Requires-Dist: azure-cognitiveservices-speech
|
25
|
-
Requires-Dist: letta-client
|
26
|
-
Requires-Dist: openai
|
27
|
-
Requires-Dist: pyyaml
|
28
|
-
Requires-Dist: pydantic
|
29
|
-
Requires-Dist: jinja2
|
30
|
-
Requires-Dist: python-multipart
|
31
|
-
Requires-Dist: mutagen
|
32
|
-
Provides-Extra: dev
|
33
|
-
Requires-Dist: pytest>=6.0; extra == "dev"
|
34
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
35
|
-
Requires-Dist: black; extra == "dev"
|
36
|
-
Requires-Dist: flake8; extra == "dev"
|
37
|
-
|
38
|
-
# Neuro-Simulator 服务端
|
39
|
-
|
40
|
-
*本临时README由AI自动生成*
|
41
|
-
|
42
|
-
这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
|
43
|
-
|
44
|
-
## 功能特性
|
45
|
-
|
46
|
-
- **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
|
47
|
-
- **配置管理**:支持通过 API 动态修改和热重载配置
|
48
|
-
- **外部控制**:完全使用外部API端点操控服务端运行
|
49
|
-
|
50
|
-
## 目录结构
|
51
|
-
|
52
|
-
``` main
|
53
|
-
neuro_simulator/
|
54
|
-
├── main.py # 应用入口和核心逻辑
|
55
|
-
├── config.py # 配置管理模块
|
56
|
-
├── letta.py # Letta Agent 集成
|
57
|
-
├── chatbot.py # 观众聊天生成器
|
58
|
-
├── audio_synthesis.py # 音频合成模块
|
59
|
-
├── stream_chat.py # 聊天消息处理
|
60
|
-
├── stream_manager.py # 直播管理器
|
61
|
-
├── websocket_manager.py # WebSocket 连接管理
|
62
|
-
├── process_manager.py # 进程管理器
|
63
|
-
├── shared_state.py # 全局状态管理
|
64
|
-
├── log_handler.py # 日志处理模块
|
65
|
-
├── requirements.txt # Python 依赖列表
|
66
|
-
├── pyproject.toml # Python 包安装配置
|
67
|
-
├── cli.py # 命令行启动脚本
|
68
|
-
├── config.yaml.example # 自带的备用配置模板
|
69
|
-
└── media/ # 自带的备用媒体文件
|
70
|
-
└── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
|
71
|
-
```
|
72
|
-
|
73
|
-
``` workin'dir
|
74
|
-
working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
|
75
|
-
├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
|
76
|
-
│ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
|
77
|
-
├── config.yaml # 由用户手工创建的配置文件
|
78
|
-
└── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
|
79
|
-
```
|
80
|
-
|
81
|
-
## 安装与配置
|
82
|
-
|
83
|
-
0. **在运行server前,必须有已经配置完成的Letta Agent。**
|
84
|
-
1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录.
|
85
|
-
- 程序会在未指定 `--dir` 的情况下自动生成一个工作目录,路径为 `~/.config/neuro-simulator/`
|
86
|
-
2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
|
87
|
-
3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
|
88
|
-
- Letta Token 和 Agent ID
|
89
|
-
- Gemini/OpenAI API Key
|
90
|
-
- Azure TTS Key 和 Region
|
91
|
-
|
92
|
-
可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
|
93
|
-
|
94
|
-
### 直接安装方式(无需二次开发)
|
95
|
-
|
96
|
-
若无需二次开发,可以直接使用pip安装:
|
97
|
-
```bash
|
98
|
-
python3 -m venv venv
|
99
|
-
# Windows
|
100
|
-
venv/Scripts/pip install neuro-simulator
|
101
|
-
# macOS/Linux
|
102
|
-
venv/bin/pip install neuro-simulator
|
103
|
-
```
|
104
|
-
|
105
|
-
### 二次开发方式
|
106
|
-
|
107
|
-
若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
|
108
|
-
```bash
|
109
|
-
git clone https://github.com/your-username/Neuro-Simulator.git
|
110
|
-
cd Neuro-Simulator/server
|
111
|
-
python3 -m venv venv
|
112
|
-
# Windows
|
113
|
-
venv/Scripts/pip install -e .
|
114
|
-
# macOS/Linux
|
115
|
-
venv/bin/pip install -e .
|
116
|
-
```
|
117
|
-
|
118
|
-
### 运行服务
|
119
|
-
|
120
|
-
```bash
|
121
|
-
# 使用默认配置 (位于~/.config/neuro-simulator/)
|
122
|
-
neuro
|
123
|
-
|
124
|
-
# 指定工作目录
|
125
|
-
neuro -D /path/to/your/config
|
126
|
-
|
127
|
-
# 指定主机和端口
|
128
|
-
neuro -H 0.0.0.0 -P 8080
|
129
|
-
|
130
|
-
# 组合使用
|
131
|
-
neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
|
132
|
-
```
|
133
|
-
|
134
|
-
服务默认运行在 `http://127.0.0.1:8000`。
|
135
|
-
|
136
|
-
## API 接口
|
137
|
-
|
138
|
-
后端提供丰富的 API 接口用于控制和管理:
|
139
|
-
|
140
|
-
- `/api/stream/*` - 直播控制接口(启动/停止/重启/状态)
|
141
|
-
- `/api/configs/*` - 配置管理接口(获取/更新/重载配置)
|
142
|
-
- `api_keys` `server` 等敏感配置项无法从接口获取和修改。
|
143
|
-
- `/api/logs` - 日志获取接口
|
144
|
-
- `/api/tts/synthesize` - TTS 合成接口
|
145
|
-
- `/api/system/health` - 健康检查接口
|
146
|
-
- `/ws/stream` - 直播内容 WebSocket 接口
|
147
|
-
- `/ws/logs` - 日志流 WebSocket 接口
|
148
|
-
|
149
|
-
详细接口说明可通过 `http://127.0.0.1:8000/docs` 访问 API 文档查看。
|
150
|
-
|
151
|
-
## 配置说明
|
152
|
-
|
153
|
-
配置文件 `config.yaml` 包含以下主要配置项:
|
154
|
-
|
155
|
-
- `api_keys` - 各种服务的 API 密钥
|
156
|
-
- `stream_metadata` - 直播元数据(标题、分类、标签等)
|
157
|
-
- `neuro_behavior` - Neuro 行为设置
|
158
|
-
- `audience_simulation` - 观众模拟设置
|
159
|
-
- `tts` - TTS 语音合成设置
|
160
|
-
- `performance` - 性能相关设置
|
161
|
-
- `server` - 服务器设置(主机、端口、CORS 等)
|
162
|
-
|
163
|
-
有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
|
164
|
-
|
165
|
-
## 安全说明
|
166
|
-
|
167
|
-
1. 通过 `panel_password` 配置项可以设置控制面板访问密码
|
168
|
-
2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
|
169
|
-
3. 支持 CORS,仅允许预配置的来源访问
|
170
|
-
|
171
|
-
## 故障排除
|
172
|
-
|
173
|
-
- 确保所有必需的 API 密钥都已正确配置
|
174
|
-
- 检查网络连接是否正常
|
175
|
-
- 查看日志文件获取错误信息
|
176
|
-
- 确保端口未被其他程序占用
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: neuro_simulator
|
3
|
+
Version: 0.2.0
|
4
|
+
Summary: Neuro Simulator Server
|
5
|
+
Author-email: Moha-Master <hongkongreporter@outlook.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/Moha-Master/neuro-simulator
|
8
|
+
Project-URL: Repository, https://github.com/Moha-Master/neuro-simulator
|
9
|
+
Project-URL: Issues, https://github.com/Moha-Master/neuro-simulator/issues
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: Operating System :: OS Independent
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Requires-Python: >=3.8
|
20
|
+
Description-Content-Type: text/markdown
|
21
|
+
Requires-Dist: fastapi
|
22
|
+
Requires-Dist: uvicorn
|
23
|
+
Requires-Dist: google-genai
|
24
|
+
Requires-Dist: azure-cognitiveservices-speech
|
25
|
+
Requires-Dist: letta-client
|
26
|
+
Requires-Dist: openai
|
27
|
+
Requires-Dist: pyyaml
|
28
|
+
Requires-Dist: pydantic
|
29
|
+
Requires-Dist: jinja2
|
30
|
+
Requires-Dist: python-multipart
|
31
|
+
Requires-Dist: mutagen
|
32
|
+
Provides-Extra: dev
|
33
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
34
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
35
|
+
Requires-Dist: black; extra == "dev"
|
36
|
+
Requires-Dist: flake8; extra == "dev"
|
37
|
+
|
38
|
+
# Neuro-Simulator 服务端
|
39
|
+
|
40
|
+
*本临时README由AI自动生成*
|
41
|
+
|
42
|
+
这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
|
43
|
+
|
44
|
+
## 功能特性
|
45
|
+
|
46
|
+
- **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
|
47
|
+
- **配置管理**:支持通过 API 动态修改和热重载配置
|
48
|
+
- **外部控制**:完全使用外部API端点操控服务端运行
|
49
|
+
|
50
|
+
## 目录结构
|
51
|
+
|
52
|
+
``` main
|
53
|
+
neuro_simulator/
|
54
|
+
├── main.py # 应用入口和核心逻辑
|
55
|
+
├── config.py # 配置管理模块
|
56
|
+
├── letta.py # Letta Agent 集成
|
57
|
+
├── chatbot.py # 观众聊天生成器
|
58
|
+
├── audio_synthesis.py # 音频合成模块
|
59
|
+
├── stream_chat.py # 聊天消息处理
|
60
|
+
├── stream_manager.py # 直播管理器
|
61
|
+
├── websocket_manager.py # WebSocket 连接管理
|
62
|
+
├── process_manager.py # 进程管理器
|
63
|
+
├── shared_state.py # 全局状态管理
|
64
|
+
├── log_handler.py # 日志处理模块
|
65
|
+
├── requirements.txt # Python 依赖列表
|
66
|
+
├── pyproject.toml # Python 包安装配置
|
67
|
+
├── cli.py # 命令行启动脚本
|
68
|
+
├── config.yaml.example # 自带的备用配置模板
|
69
|
+
└── media/ # 自带的备用媒体文件
|
70
|
+
└── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
|
71
|
+
```
|
72
|
+
|
73
|
+
``` workin'dir
|
74
|
+
working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
|
75
|
+
├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
|
76
|
+
│ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
|
77
|
+
├── config.yaml # 由用户手工创建的配置文件
|
78
|
+
└── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
|
79
|
+
```
|
80
|
+
|
81
|
+
## 安装与配置
|
82
|
+
|
83
|
+
0. **在运行server前,必须有已经配置完成的Letta Agent。**
|
84
|
+
1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录.
|
85
|
+
- 程序会在未指定 `--dir` 的情况下自动生成一个工作目录,路径为 `~/.config/neuro-simulator/`
|
86
|
+
2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
|
87
|
+
3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
|
88
|
+
- Letta Token 和 Agent ID
|
89
|
+
- Gemini/OpenAI API Key
|
90
|
+
- Azure TTS Key 和 Region
|
91
|
+
|
92
|
+
可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
|
93
|
+
|
94
|
+
### 直接安装方式(无需二次开发)
|
95
|
+
|
96
|
+
若无需二次开发,可以直接使用pip安装:
|
97
|
+
```bash
|
98
|
+
python3 -m venv venv
|
99
|
+
# Windows
|
100
|
+
venv/Scripts/pip install neuro-simulator
|
101
|
+
# macOS/Linux
|
102
|
+
venv/bin/pip install neuro-simulator
|
103
|
+
```
|
104
|
+
|
105
|
+
### 二次开发方式
|
106
|
+
|
107
|
+
若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
|
108
|
+
```bash
|
109
|
+
git clone https://github.com/your-username/Neuro-Simulator.git
|
110
|
+
cd Neuro-Simulator/server
|
111
|
+
python3 -m venv venv
|
112
|
+
# Windows
|
113
|
+
venv/Scripts/pip install -e .
|
114
|
+
# macOS/Linux
|
115
|
+
venv/bin/pip install -e .
|
116
|
+
```
|
117
|
+
|
118
|
+
### 运行服务
|
119
|
+
|
120
|
+
```bash
|
121
|
+
# 使用默认配置 (位于~/.config/neuro-simulator/)
|
122
|
+
neuro
|
123
|
+
|
124
|
+
# 指定工作目录
|
125
|
+
neuro -D /path/to/your/config
|
126
|
+
|
127
|
+
# 指定主机和端口
|
128
|
+
neuro -H 0.0.0.0 -P 8080
|
129
|
+
|
130
|
+
# 组合使用
|
131
|
+
neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
|
132
|
+
```
|
133
|
+
|
134
|
+
服务默认运行在 `http://127.0.0.1:8000`。
|
135
|
+
|
136
|
+
## API 接口
|
137
|
+
|
138
|
+
后端提供丰富的 API 接口用于控制和管理:
|
139
|
+
|
140
|
+
- `/api/stream/*` - 直播控制接口(启动/停止/重启/状态)
|
141
|
+
- `/api/configs/*` - 配置管理接口(获取/更新/重载配置)
|
142
|
+
- `api_keys` `server` 等敏感配置项无法从接口获取和修改。
|
143
|
+
- `/api/logs` - 日志获取接口
|
144
|
+
- `/api/tts/synthesize` - TTS 合成接口
|
145
|
+
- `/api/system/health` - 健康检查接口
|
146
|
+
- `/ws/stream` - 直播内容 WebSocket 接口
|
147
|
+
- `/ws/logs` - 日志流 WebSocket 接口
|
148
|
+
|
149
|
+
详细接口说明可通过 `http://127.0.0.1:8000/docs` 访问 API 文档查看。
|
150
|
+
|
151
|
+
## 配置说明
|
152
|
+
|
153
|
+
配置文件 `config.yaml` 包含以下主要配置项:
|
154
|
+
|
155
|
+
- `api_keys` - 各种服务的 API 密钥
|
156
|
+
- `stream_metadata` - 直播元数据(标题、分类、标签等)
|
157
|
+
- `neuro_behavior` - Neuro 行为设置
|
158
|
+
- `audience_simulation` - 观众模拟设置
|
159
|
+
- `tts` - TTS 语音合成设置
|
160
|
+
- `performance` - 性能相关设置
|
161
|
+
- `server` - 服务器设置(主机、端口、CORS 等)
|
162
|
+
|
163
|
+
有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
|
164
|
+
|
165
|
+
## 安全说明
|
166
|
+
|
167
|
+
1. 通过 `panel_password` 配置项可以设置控制面板访问密码
|
168
|
+
2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
|
169
|
+
3. 支持 CORS,仅允许预配置的来源访问
|
170
|
+
|
171
|
+
## 故障排除
|
172
|
+
|
173
|
+
- 确保所有必需的 API 密钥都已正确配置
|
174
|
+
- 检查网络连接是否正常
|
175
|
+
- 查看日志文件获取错误信息
|
176
|
+
- 确保端口未被其他程序占用
|
@@ -0,0 +1,37 @@
|
|
1
|
+
neuro_simulator/__init__.py,sha256=-tposzyvg6UckPcfSvtc03UjxBa9oCe_zRvlKf8splk,31
|
2
|
+
neuro_simulator/cli.py,sha256=nf69ABiVSLsOSVU0uL-bfxHN_N4kStb8kmCSetF1ffY,3606
|
3
|
+
neuro_simulator/agent/__init__.py,sha256=t52CZlyTGWqcGjMs90qvpFpRckY2WSSlO7r_H3K_mSY,32
|
4
|
+
neuro_simulator/agent/base.py,sha256=6v2ZO5UpGCwJEkJ23Oe96Rs510tK4ZOEpZ2DB49IZmM,1262
|
5
|
+
neuro_simulator/agent/core.py,sha256=WbIOU15LK9YKVeY0Osp9PJEzs0NXfgCp-aj9t9daVHc,9265
|
6
|
+
neuro_simulator/agent/factory.py,sha256=e0IBnqJQM7OuKtglrf-pWwqwmg98wh7tOq5LxF2rV-w,1146
|
7
|
+
neuro_simulator/agent/llm.py,sha256=vLz8hp2h2R0JaNfS1RLGYGkri_YoUdlEdNfFVbxeEuI,4261
|
8
|
+
neuro_simulator/agent/memory/__init__.py,sha256=YJ7cynQJI6kD7vjyv3rKc-CZqmoYSuGQtRZl_XdGEps,39
|
9
|
+
neuro_simulator/agent/memory/manager.py,sha256=z5ZI1agkuOev5gtuGA_g6MS3atB7ufdPRVNZZ89yg1w,9259
|
10
|
+
neuro_simulator/agent/tools/__init__.py,sha256=1WZy6PADfi6o1avyy1y-ThWBFAPJ_bBqtkobyYpf5ao,38
|
11
|
+
neuro_simulator/agent/tools/core.py,sha256=o6Oyis-HFD-g6Z_u3T--tkmr9ylKJvybKqMRSMUwi1Q,5555
|
12
|
+
neuro_simulator/api/__init__.py,sha256=5LWyDSayPGdQS8Rv13nmAKLyhPnMVPyTYDdvoMPB4xw,56
|
13
|
+
neuro_simulator/api/agent.py,sha256=ABl_JoIxB4wW_J2J52bWndmTXkfGJBS5LZmbGuh7zv8,6343
|
14
|
+
neuro_simulator/api/stream.py,sha256=Pg793dXLnJ0oydrIwWFgWD0cVdFAx_QOw6L5LjE0uIo,2069
|
15
|
+
neuro_simulator/api/system.py,sha256=hXznMcThuFhwopYWgpzrRxwtBuFnF_b_vinkOaE5XOs,3712
|
16
|
+
neuro_simulator/core/__init__.py,sha256=-ojq25c8XA0CU25b0OxcGjH4IWFEDHR-HXSRSZIuKe8,57
|
17
|
+
neuro_simulator/core/agent_factory.py,sha256=qMFidwT5IrOkyNHwmpO8_fRv20KLbaIBfWF-VTFCLNA,1742
|
18
|
+
neuro_simulator/core/agent_interface.py,sha256=r58Opcgs7SWVovYTjMWuxF8AiTy9QfRz276_YGmSei0,2791
|
19
|
+
neuro_simulator/core/application.py,sha256=zN8KOR_nwsYsR1ZcyZU1GlW3-ijFLbjw5lz1g8DYVIU,11578
|
20
|
+
neuro_simulator/core/config.py,sha256=brA8kiekV_995mpz04JiGj1swIWbZZuWWLNYtbroMyE,14884
|
21
|
+
neuro_simulator/services/__init__.py,sha256=s3ZrAHg5TpJakadAAGY1h0wDw_xqN4Je4aJwJyRBmk4,61
|
22
|
+
neuro_simulator/services/audience.py,sha256=0phlhsujh_GMXm_UMiyOntY-ZMtoseRa_FroIfc5A6w,5028
|
23
|
+
neuro_simulator/services/audio.py,sha256=ZscQA25wVYpm9FUl4Hya7tKH8t0TjR3th9-OEZ0G7xk,2934
|
24
|
+
neuro_simulator/services/builtin.py,sha256=7ePxEom5HIK6wGto_H5M8JOnAjyiHqUuE381DEGgzjE,3821
|
25
|
+
neuro_simulator/services/letta.py,sha256=iXyzFyPVty3SjYCHOJAF1QqhUFmxTQbqk8lYJOwB5pc,9415
|
26
|
+
neuro_simulator/services/stream.py,sha256=dG7RuNI_ICohPkqKZ-zlBppo54BgWm_KYBs-ezzc73E,5907
|
27
|
+
neuro_simulator/utils/__init__.py,sha256=xSEFzjT827W81mNyQ_DLtr00TgFlttqfFgpz9pSxFXQ,58
|
28
|
+
neuro_simulator/utils/logging.py,sha256=BO-q_cCcoeamsc8eJqq2-L3Z8nhApze_v6LnmD-O8Ww,3411
|
29
|
+
neuro_simulator/utils/process.py,sha256=FmwIuOsp19jJBEbAj-WeUpdUsQN7B9_J1rlU0Q1TXuo,2388
|
30
|
+
neuro_simulator/utils/queue.py,sha256=7SSnUnrqxHkqSeYVjp1S5kpr8qlo4IVdU2NsGwFQAVw,1546
|
31
|
+
neuro_simulator/utils/state.py,sha256=E1ilecgMTOAhiw_kNvLG0akkhdZKhzKLrA3oB4NNVTA,538
|
32
|
+
neuro_simulator/utils/websocket.py,sha256=yOdFvJzbNhcUn5EAuyS55G_R8q-snas5OvkOtS8g19E,2292
|
33
|
+
neuro_simulator-0.2.0.dist-info/METADATA,sha256=keF5r6S8qz28e89k3fxpaDh5iUOGZlSOh_WtZevaDfU,6542
|
34
|
+
neuro_simulator-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
35
|
+
neuro_simulator-0.2.0.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
|
36
|
+
neuro_simulator-0.2.0.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
|
37
|
+
neuro_simulator-0.2.0.dist-info/RECORD,,
|