neuro-simulator 0.1.2__tar.gz → 0.2.0__tar.gz

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.
Files changed (61) hide show
  1. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/PKG-INFO +176 -176
  2. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/README.md +139 -139
  3. neuro_simulator-0.2.0/neuro_simulator/__init__.py +1 -0
  4. neuro_simulator-0.2.0/neuro_simulator/agent/__init__.py +1 -0
  5. neuro_simulator-0.2.0/neuro_simulator/agent/base.py +43 -0
  6. neuro_simulator-0.2.0/neuro_simulator/agent/core.py +208 -0
  7. neuro_simulator-0.2.0/neuro_simulator/agent/factory.py +30 -0
  8. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator/agent/llm.py +34 -31
  9. neuro_simulator-0.2.0/neuro_simulator/agent/memory/__init__.py +1 -0
  10. neuro_simulator-0.2.0/neuro_simulator/agent/memory/manager.py +204 -0
  11. neuro_simulator-0.2.0/neuro_simulator/agent/tools/__init__.py +1 -0
  12. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator/agent/tools/core.py +8 -18
  13. neuro_simulator-0.2.0/neuro_simulator/api/__init__.py +1 -0
  14. neuro_simulator-0.2.0/neuro_simulator/api/agent.py +163 -0
  15. neuro_simulator-0.2.0/neuro_simulator/api/stream.py +55 -0
  16. neuro_simulator-0.2.0/neuro_simulator/api/system.py +90 -0
  17. neuro_simulator-0.2.0/neuro_simulator/cli.py +88 -0
  18. neuro_simulator-0.2.0/neuro_simulator/core/__init__.py +1 -0
  19. neuro_simulator-0.2.0/neuro_simulator/core/agent_factory.py +52 -0
  20. neuro_simulator-0.2.0/neuro_simulator/core/agent_interface.py +91 -0
  21. neuro_simulator-0.2.0/neuro_simulator/core/application.py +278 -0
  22. neuro_simulator-0.2.0/neuro_simulator/services/__init__.py +1 -0
  23. neuro_simulator-0.1.2/neuro_simulator/chatbot.py → neuro_simulator-0.2.0/neuro_simulator/services/audience.py +24 -24
  24. neuro_simulator-0.1.2/neuro_simulator/audio_synthesis.py → neuro_simulator-0.2.0/neuro_simulator/services/audio.py +18 -15
  25. neuro_simulator-0.2.0/neuro_simulator/services/builtin.py +87 -0
  26. neuro_simulator-0.2.0/neuro_simulator/services/letta.py +206 -0
  27. neuro_simulator-0.1.2/neuro_simulator/stream_manager.py → neuro_simulator-0.2.0/neuro_simulator/services/stream.py +39 -47
  28. neuro_simulator-0.2.0/neuro_simulator/utils/__init__.py +1 -0
  29. neuro_simulator-0.2.0/neuro_simulator/utils/logging.py +90 -0
  30. neuro_simulator-0.2.0/neuro_simulator/utils/process.py +67 -0
  31. neuro_simulator-0.1.2/neuro_simulator/stream_chat.py → neuro_simulator-0.2.0/neuro_simulator/utils/queue.py +17 -4
  32. neuro_simulator-0.2.0/neuro_simulator/utils/state.py +14 -0
  33. neuro_simulator-0.1.2/neuro_simulator/websocket_manager.py → neuro_simulator-0.2.0/neuro_simulator/utils/websocket.py +18 -14
  34. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator.egg-info/PKG-INFO +176 -176
  35. neuro_simulator-0.2.0/neuro_simulator.egg-info/SOURCES.txt +40 -0
  36. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/pyproject.toml +58 -58
  37. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/setup.cfg +4 -4
  38. neuro_simulator-0.1.2/neuro_simulator/__init__.py +0 -10
  39. neuro_simulator-0.1.2/neuro_simulator/agent/__init__.py +0 -8
  40. neuro_simulator-0.1.2/neuro_simulator/agent/api.py +0 -737
  41. neuro_simulator-0.1.2/neuro_simulator/agent/core.py +0 -471
  42. neuro_simulator-0.1.2/neuro_simulator/agent/memory/__init__.py +0 -4
  43. neuro_simulator-0.1.2/neuro_simulator/agent/memory/manager.py +0 -370
  44. neuro_simulator-0.1.2/neuro_simulator/agent/memory.py +0 -137
  45. neuro_simulator-0.1.2/neuro_simulator/agent/tools/__init__.py +0 -4
  46. neuro_simulator-0.1.2/neuro_simulator/agent/tools.py +0 -69
  47. neuro_simulator-0.1.2/neuro_simulator/builtin_agent.py +0 -83
  48. neuro_simulator-0.1.2/neuro_simulator/cli.py +0 -177
  49. neuro_simulator-0.1.2/neuro_simulator/config.yaml.example +0 -157
  50. neuro_simulator-0.1.2/neuro_simulator/letta.py +0 -164
  51. neuro_simulator-0.1.2/neuro_simulator/log_handler.py +0 -43
  52. neuro_simulator-0.1.2/neuro_simulator/main.py +0 -673
  53. neuro_simulator-0.1.2/neuro_simulator/media/neuro_start.mp4 +0 -0
  54. neuro_simulator-0.1.2/neuro_simulator/process_manager.py +0 -70
  55. neuro_simulator-0.1.2/neuro_simulator/shared_state.py +0 -11
  56. neuro_simulator-0.1.2/neuro_simulator.egg-info/SOURCES.txt +0 -34
  57. {neuro_simulator-0.1.2/neuro_simulator → neuro_simulator-0.2.0/neuro_simulator/core}/config.py +0 -0
  58. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator.egg-info/dependency_links.txt +0 -0
  59. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator.egg-info/entry_points.txt +0 -0
  60. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator.egg-info/requires.txt +0 -0
  61. {neuro_simulator-0.1.2 → neuro_simulator-0.2.0}/neuro_simulator.egg-info/top_level.txt +0 -0
@@ -1,176 +1,176 @@
1
- Metadata-Version: 2.4
2
- Name: neuro_simulator
3
- Version: 0.1.2
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
+ - 确保端口未被其他程序占用
@@ -1,139 +1,139 @@
1
- # Neuro-Simulator 服务端
2
-
3
- *本临时README由AI自动生成*
4
-
5
- 这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
6
-
7
- ## 功能特性
8
-
9
- - **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
10
- - **配置管理**:支持通过 API 动态修改和热重载配置
11
- - **外部控制**:完全使用外部API端点操控服务端运行
12
-
13
- ## 目录结构
14
-
15
- ``` main
16
- neuro_simulator/
17
- ├── main.py # 应用入口和核心逻辑
18
- ├── config.py # 配置管理模块
19
- ├── letta.py # Letta Agent 集成
20
- ├── chatbot.py # 观众聊天生成器
21
- ├── audio_synthesis.py # 音频合成模块
22
- ├── stream_chat.py # 聊天消息处理
23
- ├── stream_manager.py # 直播管理器
24
- ├── websocket_manager.py # WebSocket 连接管理
25
- ├── process_manager.py # 进程管理器
26
- ├── shared_state.py # 全局状态管理
27
- ├── log_handler.py # 日志处理模块
28
- ├── requirements.txt # Python 依赖列表
29
- ├── pyproject.toml # Python 包安装配置
30
- ├── cli.py # 命令行启动脚本
31
- ├── config.yaml.example # 自带的备用配置模板
32
- └── media/ # 自带的备用媒体文件
33
- └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
34
- ```
35
-
36
- ``` workin'dir
37
- working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
38
- ├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
39
- │ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
40
- ├── config.yaml # 由用户手工创建的配置文件
41
- └── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
42
- ```
43
-
44
- ## 安装与配置
45
-
46
- 0. **在运行server前,必须有已经配置完成的Letta Agent。**
47
- 1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录.
48
- - 程序会在未指定 `--dir` 的情况下自动生成一个工作目录,路径为 `~/.config/neuro-simulator/`
49
- 2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
50
- 3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
51
- - Letta Token 和 Agent ID
52
- - Gemini/OpenAI API Key
53
- - Azure TTS Key 和 Region
54
-
55
- 可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
56
-
57
- ### 直接安装方式(无需二次开发)
58
-
59
- 若无需二次开发,可以直接使用pip安装:
60
- ```bash
61
- python3 -m venv venv
62
- # Windows
63
- venv/Scripts/pip install neuro-simulator
64
- # macOS/Linux
65
- venv/bin/pip install neuro-simulator
66
- ```
67
-
68
- ### 二次开发方式
69
-
70
- 若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
71
- ```bash
72
- git clone https://github.com/your-username/Neuro-Simulator.git
73
- cd Neuro-Simulator/server
74
- python3 -m venv venv
75
- # Windows
76
- venv/Scripts/pip install -e .
77
- # macOS/Linux
78
- venv/bin/pip install -e .
79
- ```
80
-
81
- ### 运行服务
82
-
83
- ```bash
84
- # 使用默认配置 (位于~/.config/neuro-simulator/)
85
- neuro
86
-
87
- # 指定工作目录
88
- neuro -D /path/to/your/config
89
-
90
- # 指定主机和端口
91
- neuro -H 0.0.0.0 -P 8080
92
-
93
- # 组合使用
94
- neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
95
- ```
96
-
97
- 服务默认运行在 `http://127.0.0.1:8000`。
98
-
99
- ## API 接口
100
-
101
- 后端提供丰富的 API 接口用于控制和管理:
102
-
103
- - `/api/stream/*` - 直播控制接口(启动/停止/重启/状态)
104
- - `/api/configs/*` - 配置管理接口(获取/更新/重载配置)
105
- - `api_keys` `server` 等敏感配置项无法从接口获取和修改。
106
- - `/api/logs` - 日志获取接口
107
- - `/api/tts/synthesize` - TTS 合成接口
108
- - `/api/system/health` - 健康检查接口
109
- - `/ws/stream` - 直播内容 WebSocket 接口
110
- - `/ws/logs` - 日志流 WebSocket 接口
111
-
112
- 详细接口说明可通过 `http://127.0.0.1:8000/docs` 访问 API 文档查看。
113
-
114
- ## 配置说明
115
-
116
- 配置文件 `config.yaml` 包含以下主要配置项:
117
-
118
- - `api_keys` - 各种服务的 API 密钥
119
- - `stream_metadata` - 直播元数据(标题、分类、标签等)
120
- - `neuro_behavior` - Neuro 行为设置
121
- - `audience_simulation` - 观众模拟设置
122
- - `tts` - TTS 语音合成设置
123
- - `performance` - 性能相关设置
124
- - `server` - 服务器设置(主机、端口、CORS 等)
125
-
126
- 有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
127
-
128
- ## 安全说明
129
-
130
- 1. 通过 `panel_password` 配置项可以设置控制面板访问密码
131
- 2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
132
- 3. 支持 CORS,仅允许预配置的来源访问
133
-
134
- ## 故障排除
135
-
136
- - 确保所有必需的 API 密钥都已正确配置
137
- - 检查网络连接是否正常
138
- - 查看日志文件获取错误信息
139
- - 确保端口未被其他程序占用
1
+ # Neuro-Simulator 服务端
2
+
3
+ *本临时README由AI自动生成*
4
+
5
+ 这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
6
+
7
+ ## 功能特性
8
+
9
+ - **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
10
+ - **配置管理**:支持通过 API 动态修改和热重载配置
11
+ - **外部控制**:完全使用外部API端点操控服务端运行
12
+
13
+ ## 目录结构
14
+
15
+ ``` main
16
+ neuro_simulator/
17
+ ├── main.py # 应用入口和核心逻辑
18
+ ├── config.py # 配置管理模块
19
+ ├── letta.py # Letta Agent 集成
20
+ ├── chatbot.py # 观众聊天生成器
21
+ ├── audio_synthesis.py # 音频合成模块
22
+ ├── stream_chat.py # 聊天消息处理
23
+ ├── stream_manager.py # 直播管理器
24
+ ├── websocket_manager.py # WebSocket 连接管理
25
+ ├── process_manager.py # 进程管理器
26
+ ├── shared_state.py # 全局状态管理
27
+ ├── log_handler.py # 日志处理模块
28
+ ├── requirements.txt # Python 依赖列表
29
+ ├── pyproject.toml # Python 包安装配置
30
+ ├── cli.py # 命令行启动脚本
31
+ ├── config.yaml.example # 自带的备用配置模板
32
+ └── media/ # 自带的备用媒体文件
33
+ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
34
+ ```
35
+
36
+ ``` workin'dir
37
+ working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
38
+ ├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
39
+ │ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
40
+ ├── config.yaml # 由用户手工创建的配置文件
41
+ └── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
42
+ ```
43
+
44
+ ## 安装与配置
45
+
46
+ 0. **在运行server前,必须有已经配置完成的Letta Agent。**
47
+ 1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录.
48
+ - 程序会在未指定 `--dir` 的情况下自动生成一个工作目录,路径为 `~/.config/neuro-simulator/`
49
+ 2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
50
+ 3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
51
+ - Letta Token 和 Agent ID
52
+ - Gemini/OpenAI API Key
53
+ - Azure TTS Key 和 Region
54
+
55
+ 可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
56
+
57
+ ### 直接安装方式(无需二次开发)
58
+
59
+ 若无需二次开发,可以直接使用pip安装:
60
+ ```bash
61
+ python3 -m venv venv
62
+ # Windows
63
+ venv/Scripts/pip install neuro-simulator
64
+ # macOS/Linux
65
+ venv/bin/pip install neuro-simulator
66
+ ```
67
+
68
+ ### 二次开发方式
69
+
70
+ 若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
71
+ ```bash
72
+ git clone https://github.com/your-username/Neuro-Simulator.git
73
+ cd Neuro-Simulator/server
74
+ python3 -m venv venv
75
+ # Windows
76
+ venv/Scripts/pip install -e .
77
+ # macOS/Linux
78
+ venv/bin/pip install -e .
79
+ ```
80
+
81
+ ### 运行服务
82
+
83
+ ```bash
84
+ # 使用默认配置 (位于~/.config/neuro-simulator/)
85
+ neuro
86
+
87
+ # 指定工作目录
88
+ neuro -D /path/to/your/config
89
+
90
+ # 指定主机和端口
91
+ neuro -H 0.0.0.0 -P 8080
92
+
93
+ # 组合使用
94
+ neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
95
+ ```
96
+
97
+ 服务默认运行在 `http://127.0.0.1:8000`。
98
+
99
+ ## API 接口
100
+
101
+ 后端提供丰富的 API 接口用于控制和管理:
102
+
103
+ - `/api/stream/*` - 直播控制接口(启动/停止/重启/状态)
104
+ - `/api/configs/*` - 配置管理接口(获取/更新/重载配置)
105
+ - `api_keys` `server` 等敏感配置项无法从接口获取和修改。
106
+ - `/api/logs` - 日志获取接口
107
+ - `/api/tts/synthesize` - TTS 合成接口
108
+ - `/api/system/health` - 健康检查接口
109
+ - `/ws/stream` - 直播内容 WebSocket 接口
110
+ - `/ws/logs` - 日志流 WebSocket 接口
111
+
112
+ 详细接口说明可通过 `http://127.0.0.1:8000/docs` 访问 API 文档查看。
113
+
114
+ ## 配置说明
115
+
116
+ 配置文件 `config.yaml` 包含以下主要配置项:
117
+
118
+ - `api_keys` - 各种服务的 API 密钥
119
+ - `stream_metadata` - 直播元数据(标题、分类、标签等)
120
+ - `neuro_behavior` - Neuro 行为设置
121
+ - `audience_simulation` - 观众模拟设置
122
+ - `tts` - TTS 语音合成设置
123
+ - `performance` - 性能相关设置
124
+ - `server` - 服务器设置(主机、端口、CORS 等)
125
+
126
+ 有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
127
+
128
+ ## 安全说明
129
+
130
+ 1. 通过 `panel_password` 配置项可以设置控制面板访问密码
131
+ 2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
132
+ 3. 支持 CORS,仅允许预配置的来源访问
133
+
134
+ ## 故障排除
135
+
136
+ - 确保所有必需的 API 密钥都已正确配置
137
+ - 检查网络连接是否正常
138
+ - 查看日志文件获取错误信息
139
+ - 确保端口未被其他程序占用
@@ -0,0 +1 @@
1
+ # neuro_simulator package root
@@ -0,0 +1 @@
1
+ # neuro_simulator.agent package