neuro-simulator 0.0.1__tar.gz → 0.0.3__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.
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/PKG-INFO +62 -97
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/README.md +60 -75
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/cli.py +12 -12
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/config.py +5 -5
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/PKG-INFO +62 -97
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/SOURCES.txt +1 -1
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/setup.py +16 -9
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/__init__.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/audio_synthesis.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/chatbot.py +0 -0
- neuro_simulator-0.0.1/neuro_simulator/settings.yaml.example → neuro-simulator-0.0.3/neuro_simulator/config.yaml.example +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/letta.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/log_handler.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/main.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/media/neuro_start.mp4 +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/process_manager.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/shared_state.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/stream_chat.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/stream_manager.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator/websocket_manager.py +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/dependency_links.txt +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/entry_points.txt +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/requires.txt +5 -5
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/top_level.txt +0 -0
- {neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: neuro-simulator
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: Neuro Simulator Server
|
5
5
|
Home-page: https://github.com/Moha-Master/neuro-simulator
|
6
6
|
Author: Moha-Master
|
@@ -17,44 +17,22 @@ Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
18
18
|
Requires-Python: >=3.8
|
19
19
|
Description-Content-Type: text/markdown
|
20
|
-
Requires-Dist: fastapi
|
21
|
-
Requires-Dist: uvicorn
|
22
|
-
Requires-Dist: google-genai
|
23
|
-
Requires-Dist: azure-cognitiveservices-speech
|
24
|
-
Requires-Dist: letta-client
|
25
|
-
Requires-Dist: openai
|
26
|
-
Requires-Dist: pyyaml
|
27
|
-
Requires-Dist: pydantic
|
28
|
-
Requires-Dist: jinja2
|
29
|
-
Requires-Dist: python-multipart
|
30
|
-
Requires-Dist: mutagen
|
31
|
-
Dynamic: author
|
32
|
-
Dynamic: author-email
|
33
|
-
Dynamic: classifier
|
34
|
-
Dynamic: description
|
35
|
-
Dynamic: description-content-type
|
36
|
-
Dynamic: home-page
|
37
|
-
Dynamic: requires-dist
|
38
|
-
Dynamic: requires-python
|
39
|
-
Dynamic: summary
|
40
20
|
|
41
21
|
# Neuro-Simulator 服务端
|
42
22
|
|
43
|
-
*关注Vedal喵,关注Vedal谢谢喵*
|
44
|
-
|
45
23
|
*本临时README由AI自动生成*
|
46
24
|
|
47
|
-
这是 Neuro Simulator
|
25
|
+
这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
|
48
26
|
|
49
27
|
## 功能特性
|
50
28
|
|
51
|
-
-
|
29
|
+
- **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
|
52
30
|
- **配置管理**:支持通过 API 动态修改和热重载配置
|
53
31
|
- **外部控制**:完全使用外部API端点操控服务端运行
|
54
32
|
|
55
33
|
## 目录结构
|
56
34
|
|
57
|
-
```
|
35
|
+
``` main
|
58
36
|
neuro_simulator/
|
59
37
|
├── main.py # 应用入口和核心逻辑
|
60
38
|
├── config.py # 配置管理模块
|
@@ -70,85 +48,70 @@ neuro_simulator/
|
|
70
48
|
├── requirements.txt # Python 依赖列表
|
71
49
|
├── setup.py # Python 包安装配置
|
72
50
|
├── cli.py # 命令行启动脚本
|
73
|
-
├──
|
51
|
+
├── config.yaml.example # 自带的备用配置模板
|
74
52
|
└── media/ # 自带的备用媒体文件
|
75
|
-
|
53
|
+
└── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
|
76
54
|
```
|
77
55
|
|
78
|
-
```
|
79
|
-
working_dir_example/ #
|
56
|
+
``` workin'dir
|
57
|
+
working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
|
80
58
|
├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
|
81
|
-
│
|
82
|
-
├──
|
83
|
-
└──
|
59
|
+
│ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
|
60
|
+
├── config.yaml # 由用户手工创建的配置文件
|
61
|
+
└── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
|
84
62
|
```
|
85
63
|
|
86
64
|
## 安装与配置
|
87
65
|
|
88
|
-
0.
|
89
|
-
|
90
|
-
|
91
|
-
|
66
|
+
0. **在运行server前,必须有已经配置完成的Letta Agent。**
|
67
|
+
1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录
|
68
|
+
2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
|
69
|
+
3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
|
92
70
|
- Letta Token 和 Agent ID
|
93
71
|
- Gemini/OpenAI API Key
|
94
72
|
- Azure TTS Key 和 Region
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
# Windows
|
138
|
-
venv\Scripts\activate
|
139
|
-
# macOS/Linux
|
140
|
-
source venv/bin/activate
|
141
|
-
```
|
142
|
-
|
143
|
-
2. **安装依赖**
|
144
|
-
```bash
|
145
|
-
pip install -r requirements.txt
|
146
|
-
```
|
147
|
-
|
148
|
-
3. **启动服务**
|
149
|
-
```bash
|
150
|
-
uvicorn main:app --host 127.0.0.1 --port 8000
|
151
|
-
```
|
73
|
+
|
74
|
+
可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
|
75
|
+
|
76
|
+
### 直接安装方式(无需二次开发)
|
77
|
+
|
78
|
+
若无需二次开发,可以直接使用pip安装:
|
79
|
+
```bash
|
80
|
+
python3 -m venv venv
|
81
|
+
# Windows
|
82
|
+
venv/Scripts/pip install neuro-simulator
|
83
|
+
# macOS/Linux
|
84
|
+
venv/bin/pip install neuro-simulator
|
85
|
+
```
|
86
|
+
|
87
|
+
### 二次开发方式
|
88
|
+
|
89
|
+
若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
|
90
|
+
```bash
|
91
|
+
git clone https://github.com/your-username/Neuro-Simulator.git
|
92
|
+
cd Neuro-Simulator/server
|
93
|
+
python3 -m venv venv
|
94
|
+
# Windows
|
95
|
+
venv/Scripts/pip install -e .
|
96
|
+
# macOS/Linux
|
97
|
+
venv/bin/pip install -e .
|
98
|
+
```
|
99
|
+
|
100
|
+
### 运行服务
|
101
|
+
|
102
|
+
```bash
|
103
|
+
# 使用默认配置 (位于~/.config/neuro-simulator/)
|
104
|
+
neuro
|
105
|
+
|
106
|
+
# 指定工作目录
|
107
|
+
neuro -D /path/to/your/config
|
108
|
+
|
109
|
+
# 指定主机和端口
|
110
|
+
neuro -H 0.0.0.0 -P 8080
|
111
|
+
|
112
|
+
# 组合使用
|
113
|
+
neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
|
114
|
+
```
|
152
115
|
|
153
116
|
服务默认运行在 `http://127.0.0.1:8000`。
|
154
117
|
|
@@ -169,7 +132,7 @@ working_dir_example/ # 工作目录结构
|
|
169
132
|
|
170
133
|
## 配置说明
|
171
134
|
|
172
|
-
配置文件 `
|
135
|
+
配置文件 `config.yaml` 包含以下主要配置项:
|
173
136
|
|
174
137
|
- `api_keys` - 各种服务的 API 密钥
|
175
138
|
- `stream_metadata` - 直播元数据(标题、分类、标签等)
|
@@ -179,11 +142,13 @@ working_dir_example/ # 工作目录结构
|
|
179
142
|
- `performance` - 性能相关设置
|
180
143
|
- `server` - 服务器设置(主机、端口、CORS 等)
|
181
144
|
|
145
|
+
有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
|
146
|
+
|
182
147
|
## 安全说明
|
183
148
|
|
184
149
|
1. 通过 `panel_password` 配置项可以设置控制面板访问密码
|
185
150
|
2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
|
186
|
-
3. 支持 CORS
|
151
|
+
3. 支持 CORS,仅允许预配置的来源访问
|
187
152
|
|
188
153
|
## 故障排除
|
189
154
|
|
@@ -1,20 +1,18 @@
|
|
1
1
|
# Neuro-Simulator 服务端
|
2
2
|
|
3
|
-
*关注Vedal喵,关注Vedal谢谢喵*
|
4
|
-
|
5
3
|
*本临时README由AI自动生成*
|
6
4
|
|
7
|
-
这是 Neuro Simulator
|
5
|
+
这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
|
8
6
|
|
9
7
|
## 功能特性
|
10
8
|
|
11
|
-
-
|
9
|
+
- **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
|
12
10
|
- **配置管理**:支持通过 API 动态修改和热重载配置
|
13
11
|
- **外部控制**:完全使用外部API端点操控服务端运行
|
14
12
|
|
15
13
|
## 目录结构
|
16
14
|
|
17
|
-
```
|
15
|
+
``` main
|
18
16
|
neuro_simulator/
|
19
17
|
├── main.py # 应用入口和核心逻辑
|
20
18
|
├── config.py # 配置管理模块
|
@@ -30,85 +28,70 @@ neuro_simulator/
|
|
30
28
|
├── requirements.txt # Python 依赖列表
|
31
29
|
├── setup.py # Python 包安装配置
|
32
30
|
├── cli.py # 命令行启动脚本
|
33
|
-
├──
|
31
|
+
├── config.yaml.example # 自带的备用配置模板
|
34
32
|
└── media/ # 自带的备用媒体文件
|
35
|
-
|
33
|
+
└── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
|
36
34
|
```
|
37
35
|
|
38
|
-
```
|
39
|
-
working_dir_example/ #
|
36
|
+
``` workin'dir
|
37
|
+
working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
|
40
38
|
├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
|
41
|
-
│
|
42
|
-
├──
|
43
|
-
└──
|
39
|
+
│ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
|
40
|
+
├── config.yaml # 由用户手工创建的配置文件
|
41
|
+
└── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
|
44
42
|
```
|
45
43
|
|
46
44
|
## 安装与配置
|
47
45
|
|
48
|
-
0.
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
0. **在运行server前,必须有已经配置完成的Letta Agent。**
|
47
|
+
1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录
|
48
|
+
2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
|
49
|
+
3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
|
52
50
|
- Letta Token 和 Agent ID
|
53
51
|
- Gemini/OpenAI API Key
|
54
52
|
- Azure TTS Key 和 Region
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
# Windows
|
98
|
-
venv\Scripts\activate
|
99
|
-
# macOS/Linux
|
100
|
-
source venv/bin/activate
|
101
|
-
```
|
102
|
-
|
103
|
-
2. **安装依赖**
|
104
|
-
```bash
|
105
|
-
pip install -r requirements.txt
|
106
|
-
```
|
107
|
-
|
108
|
-
3. **启动服务**
|
109
|
-
```bash
|
110
|
-
uvicorn main:app --host 127.0.0.1 --port 8000
|
111
|
-
```
|
53
|
+
|
54
|
+
可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
|
55
|
+
|
56
|
+
### 直接安装方式(无需二次开发)
|
57
|
+
|
58
|
+
若无需二次开发,可以直接使用pip安装:
|
59
|
+
```bash
|
60
|
+
python3 -m venv venv
|
61
|
+
# Windows
|
62
|
+
venv/Scripts/pip install neuro-simulator
|
63
|
+
# macOS/Linux
|
64
|
+
venv/bin/pip install neuro-simulator
|
65
|
+
```
|
66
|
+
|
67
|
+
### 二次开发方式
|
68
|
+
|
69
|
+
若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
|
70
|
+
```bash
|
71
|
+
git clone https://github.com/your-username/Neuro-Simulator.git
|
72
|
+
cd Neuro-Simulator/server
|
73
|
+
python3 -m venv venv
|
74
|
+
# Windows
|
75
|
+
venv/Scripts/pip install -e .
|
76
|
+
# macOS/Linux
|
77
|
+
venv/bin/pip install -e .
|
78
|
+
```
|
79
|
+
|
80
|
+
### 运行服务
|
81
|
+
|
82
|
+
```bash
|
83
|
+
# 使用默认配置 (位于~/.config/neuro-simulator/)
|
84
|
+
neuro
|
85
|
+
|
86
|
+
# 指定工作目录
|
87
|
+
neuro -D /path/to/your/config
|
88
|
+
|
89
|
+
# 指定主机和端口
|
90
|
+
neuro -H 0.0.0.0 -P 8080
|
91
|
+
|
92
|
+
# 组合使用
|
93
|
+
neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
|
94
|
+
```
|
112
95
|
|
113
96
|
服务默认运行在 `http://127.0.0.1:8000`。
|
114
97
|
|
@@ -129,7 +112,7 @@ working_dir_example/ # 工作目录结构
|
|
129
112
|
|
130
113
|
## 配置说明
|
131
114
|
|
132
|
-
配置文件 `
|
115
|
+
配置文件 `config.yaml` 包含以下主要配置项:
|
133
116
|
|
134
117
|
- `api_keys` - 各种服务的 API 密钥
|
135
118
|
- `stream_metadata` - 直播元数据(标题、分类、标签等)
|
@@ -139,11 +122,13 @@ working_dir_example/ # 工作目录结构
|
|
139
122
|
- `performance` - 性能相关设置
|
140
123
|
- `server` - 服务器设置(主机、端口、CORS 等)
|
141
124
|
|
125
|
+
有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
|
126
|
+
|
142
127
|
## 安全说明
|
143
128
|
|
144
129
|
1. 通过 `panel_password` 配置项可以设置控制面板访问密码
|
145
130
|
2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
|
146
|
-
3. 支持 CORS
|
131
|
+
3. 支持 CORS,仅允许预配置的来源访问
|
147
132
|
|
148
133
|
## 故障排除
|
149
134
|
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
8
8
|
|
9
9
|
def main():
|
10
10
|
parser = argparse.ArgumentParser(description="Neuro-Simulator Server")
|
11
|
-
parser.add_argument("-D", "--dir", help="Working directory containing
|
11
|
+
parser.add_argument("-D", "--dir", help="Working directory containing config.yaml")
|
12
12
|
parser.add_argument("-H", "--host", help="Host to bind the server to")
|
13
13
|
parser.add_argument("-P", "--port", type=int, help="Port to bind the server to")
|
14
14
|
|
@@ -28,38 +28,38 @@ def main():
|
|
28
28
|
# Change to working directory
|
29
29
|
os.chdir(work_dir)
|
30
30
|
|
31
|
-
# Handle
|
32
|
-
settings_example_path = work_dir / "
|
33
|
-
settings_path = work_dir / "
|
31
|
+
# Handle config.yaml.example
|
32
|
+
settings_example_path = work_dir / "config.yaml.example"
|
33
|
+
settings_path = work_dir / "config.yaml"
|
34
34
|
|
35
|
-
# Copy
|
35
|
+
# Copy config.yaml.example from package if it doesn't exist
|
36
36
|
if not settings_example_path.exists():
|
37
37
|
try:
|
38
38
|
# Try pkg_resources first (for installed packages)
|
39
39
|
try:
|
40
40
|
import pkg_resources
|
41
|
-
example_path = pkg_resources.resource_filename('neuro_simulator', '
|
41
|
+
example_path = pkg_resources.resource_filename('neuro_simulator', 'config.yaml.example')
|
42
42
|
if os.path.exists(example_path):
|
43
43
|
shutil.copy(example_path, settings_example_path)
|
44
44
|
print(f"Created {settings_example_path} from package example")
|
45
45
|
else:
|
46
46
|
# Fallback to relative path (for development mode)
|
47
|
-
dev_example_path = Path(__file__).parent / "
|
47
|
+
dev_example_path = Path(__file__).parent / "config.yaml.example"
|
48
48
|
if dev_example_path.exists():
|
49
49
|
shutil.copy(dev_example_path, settings_example_path)
|
50
50
|
print(f"Created {settings_example_path} from development example")
|
51
51
|
else:
|
52
|
-
print("Warning:
|
52
|
+
print("Warning: config.yaml.example not found in package or development folder")
|
53
53
|
except Exception:
|
54
54
|
# Fallback to relative path (for development mode)
|
55
|
-
dev_example_path = Path(__file__).parent / "
|
55
|
+
dev_example_path = Path(__file__).parent / "config.yaml.example"
|
56
56
|
if dev_example_path.exists():
|
57
57
|
shutil.copy(dev_example_path, settings_example_path)
|
58
58
|
print(f"Created {settings_example_path} from development example")
|
59
59
|
else:
|
60
|
-
print("Warning:
|
60
|
+
print("Warning: config.yaml.example not found in package or development folder")
|
61
61
|
except Exception as e:
|
62
|
-
print(f"Warning: Could not copy
|
62
|
+
print(f"Warning: Could not copy config.yaml.example from package: {e}")
|
63
63
|
|
64
64
|
# Handle media folder
|
65
65
|
media_dir = work_dir / "media"
|
@@ -101,7 +101,7 @@ def main():
|
|
101
101
|
# Now check for required files and handle errors appropriately
|
102
102
|
errors = []
|
103
103
|
|
104
|
-
# Check for
|
104
|
+
# Check for config.yaml (required for running)
|
105
105
|
if not settings_path.exists():
|
106
106
|
if settings_example_path.exists():
|
107
107
|
errors.append(f"Error: {settings_path} not found. Please copy {settings_example_path} to {settings_path} and configure it.")
|
@@ -88,7 +88,7 @@ class AppSettings(BaseModel):
|
|
88
88
|
|
89
89
|
# --- 2. 加载和管理配置的逻辑 ---
|
90
90
|
|
91
|
-
CONFIG_FILE_PATH = "
|
91
|
+
CONFIG_FILE_PATH = "config.yaml"
|
92
92
|
|
93
93
|
def _deep_update(source: dict, overrides: dict) -> dict:
|
94
94
|
"""
|
@@ -120,7 +120,7 @@ class ConfigManager:
|
|
120
120
|
|
121
121
|
def _load_config_from_yaml(self) -> dict:
|
122
122
|
if not os.path.exists(CONFIG_FILE_PATH):
|
123
|
-
logging.warning(f"{CONFIG_FILE_PATH} not found. Using default settings. You can create it from
|
123
|
+
logging.warning(f"{CONFIG_FILE_PATH} not found. Using default settings. You can create it from config.yaml.example.")
|
124
124
|
return {}
|
125
125
|
try:
|
126
126
|
with open(CONFIG_FILE_PATH, 'r', encoding='utf-8') as f:
|
@@ -141,14 +141,14 @@ class ConfigManager:
|
|
141
141
|
missing_keys.append("api_keys.neuro_agent_id")
|
142
142
|
|
143
143
|
if missing_keys:
|
144
|
-
raise ValueError(f"Critical config missing in
|
145
|
-
f"Please check your
|
144
|
+
raise ValueError(f"Critical config missing in config.yaml: {', '.join(missing_keys)}. "
|
145
|
+
f"Please check your config.yaml file against config.yaml.example.")
|
146
146
|
|
147
147
|
logging.info("Configuration loaded successfully.")
|
148
148
|
return base_settings
|
149
149
|
|
150
150
|
def save_settings(self):
|
151
|
-
"""Saves the current configuration to
|
151
|
+
"""Saves the current configuration to config.yaml."""
|
152
152
|
try:
|
153
153
|
# 1. Get the current settings from memory
|
154
154
|
config_to_save = self.settings.model_dump(mode='json', exclude={'api_keys'})
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: neuro-simulator
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: Neuro Simulator Server
|
5
5
|
Home-page: https://github.com/Moha-Master/neuro-simulator
|
6
6
|
Author: Moha-Master
|
@@ -17,44 +17,22 @@ Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
18
18
|
Requires-Python: >=3.8
|
19
19
|
Description-Content-Type: text/markdown
|
20
|
-
Requires-Dist: fastapi
|
21
|
-
Requires-Dist: uvicorn
|
22
|
-
Requires-Dist: google-genai
|
23
|
-
Requires-Dist: azure-cognitiveservices-speech
|
24
|
-
Requires-Dist: letta-client
|
25
|
-
Requires-Dist: openai
|
26
|
-
Requires-Dist: pyyaml
|
27
|
-
Requires-Dist: pydantic
|
28
|
-
Requires-Dist: jinja2
|
29
|
-
Requires-Dist: python-multipart
|
30
|
-
Requires-Dist: mutagen
|
31
|
-
Dynamic: author
|
32
|
-
Dynamic: author-email
|
33
|
-
Dynamic: classifier
|
34
|
-
Dynamic: description
|
35
|
-
Dynamic: description-content-type
|
36
|
-
Dynamic: home-page
|
37
|
-
Dynamic: requires-dist
|
38
|
-
Dynamic: requires-python
|
39
|
-
Dynamic: summary
|
40
20
|
|
41
21
|
# Neuro-Simulator 服务端
|
42
22
|
|
43
|
-
*关注Vedal喵,关注Vedal谢谢喵*
|
44
|
-
|
45
23
|
*本临时README由AI自动生成*
|
46
24
|
|
47
|
-
这是 Neuro Simulator
|
25
|
+
这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
|
48
26
|
|
49
27
|
## 功能特性
|
50
28
|
|
51
|
-
-
|
29
|
+
- **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
|
52
30
|
- **配置管理**:支持通过 API 动态修改和热重载配置
|
53
31
|
- **外部控制**:完全使用外部API端点操控服务端运行
|
54
32
|
|
55
33
|
## 目录结构
|
56
34
|
|
57
|
-
```
|
35
|
+
``` main
|
58
36
|
neuro_simulator/
|
59
37
|
├── main.py # 应用入口和核心逻辑
|
60
38
|
├── config.py # 配置管理模块
|
@@ -70,85 +48,70 @@ neuro_simulator/
|
|
70
48
|
├── requirements.txt # Python 依赖列表
|
71
49
|
├── setup.py # Python 包安装配置
|
72
50
|
├── cli.py # 命令行启动脚本
|
73
|
-
├──
|
51
|
+
├── config.yaml.example # 自带的备用配置模板
|
74
52
|
└── media/ # 自带的备用媒体文件
|
75
|
-
|
53
|
+
└── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
|
76
54
|
```
|
77
55
|
|
78
|
-
```
|
79
|
-
working_dir_example/ #
|
56
|
+
``` workin'dir
|
57
|
+
working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
|
80
58
|
├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
|
81
|
-
│
|
82
|
-
├──
|
83
|
-
└──
|
59
|
+
│ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
|
60
|
+
├── config.yaml # 由用户手工创建的配置文件
|
61
|
+
└── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
|
84
62
|
```
|
85
63
|
|
86
64
|
## 安装与配置
|
87
65
|
|
88
|
-
0.
|
89
|
-
|
90
|
-
|
91
|
-
|
66
|
+
0. **在运行server前,必须有已经配置完成的Letta Agent。**
|
67
|
+
1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录
|
68
|
+
2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
|
69
|
+
3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
|
92
70
|
- Letta Token 和 Agent ID
|
93
71
|
- Gemini/OpenAI API Key
|
94
72
|
- Azure TTS Key 和 Region
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
# Windows
|
138
|
-
venv\Scripts\activate
|
139
|
-
# macOS/Linux
|
140
|
-
source venv/bin/activate
|
141
|
-
```
|
142
|
-
|
143
|
-
2. **安装依赖**
|
144
|
-
```bash
|
145
|
-
pip install -r requirements.txt
|
146
|
-
```
|
147
|
-
|
148
|
-
3. **启动服务**
|
149
|
-
```bash
|
150
|
-
uvicorn main:app --host 127.0.0.1 --port 8000
|
151
|
-
```
|
73
|
+
|
74
|
+
可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
|
75
|
+
|
76
|
+
### 直接安装方式(无需二次开发)
|
77
|
+
|
78
|
+
若无需二次开发,可以直接使用pip安装:
|
79
|
+
```bash
|
80
|
+
python3 -m venv venv
|
81
|
+
# Windows
|
82
|
+
venv/Scripts/pip install neuro-simulator
|
83
|
+
# macOS/Linux
|
84
|
+
venv/bin/pip install neuro-simulator
|
85
|
+
```
|
86
|
+
|
87
|
+
### 二次开发方式
|
88
|
+
|
89
|
+
若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
|
90
|
+
```bash
|
91
|
+
git clone https://github.com/your-username/Neuro-Simulator.git
|
92
|
+
cd Neuro-Simulator/server
|
93
|
+
python3 -m venv venv
|
94
|
+
# Windows
|
95
|
+
venv/Scripts/pip install -e .
|
96
|
+
# macOS/Linux
|
97
|
+
venv/bin/pip install -e .
|
98
|
+
```
|
99
|
+
|
100
|
+
### 运行服务
|
101
|
+
|
102
|
+
```bash
|
103
|
+
# 使用默认配置 (位于~/.config/neuro-simulator/)
|
104
|
+
neuro
|
105
|
+
|
106
|
+
# 指定工作目录
|
107
|
+
neuro -D /path/to/your/config
|
108
|
+
|
109
|
+
# 指定主机和端口
|
110
|
+
neuro -H 0.0.0.0 -P 8080
|
111
|
+
|
112
|
+
# 组合使用
|
113
|
+
neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
|
114
|
+
```
|
152
115
|
|
153
116
|
服务默认运行在 `http://127.0.0.1:8000`。
|
154
117
|
|
@@ -169,7 +132,7 @@ working_dir_example/ # 工作目录结构
|
|
169
132
|
|
170
133
|
## 配置说明
|
171
134
|
|
172
|
-
配置文件 `
|
135
|
+
配置文件 `config.yaml` 包含以下主要配置项:
|
173
136
|
|
174
137
|
- `api_keys` - 各种服务的 API 密钥
|
175
138
|
- `stream_metadata` - 直播元数据(标题、分类、标签等)
|
@@ -179,11 +142,13 @@ working_dir_example/ # 工作目录结构
|
|
179
142
|
- `performance` - 性能相关设置
|
180
143
|
- `server` - 服务器设置(主机、端口、CORS 等)
|
181
144
|
|
145
|
+
有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
|
146
|
+
|
182
147
|
## 安全说明
|
183
148
|
|
184
149
|
1. 通过 `panel_password` 配置项可以设置控制面板访问密码
|
185
150
|
2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
|
186
|
-
3. 支持 CORS
|
151
|
+
3. 支持 CORS,仅允许预配置的来源访问
|
187
152
|
|
188
153
|
## 故障排除
|
189
154
|
|
@@ -5,11 +5,11 @@ neuro_simulator/audio_synthesis.py
|
|
5
5
|
neuro_simulator/chatbot.py
|
6
6
|
neuro_simulator/cli.py
|
7
7
|
neuro_simulator/config.py
|
8
|
+
neuro_simulator/config.yaml.example
|
8
9
|
neuro_simulator/letta.py
|
9
10
|
neuro_simulator/log_handler.py
|
10
11
|
neuro_simulator/main.py
|
11
12
|
neuro_simulator/process_manager.py
|
12
|
-
neuro_simulator/settings.yaml.example
|
13
13
|
neuro_simulator/shared_state.py
|
14
14
|
neuro_simulator/stream_chat.py
|
15
15
|
neuro_simulator/stream_manager.py
|
@@ -9,17 +9,24 @@ if os.path.exists(readme_path):
|
|
9
9
|
else:
|
10
10
|
long_description = "A simulator for Neuro-Sama's streaming behavior"
|
11
11
|
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
# Define requirements directly
|
13
|
+
requirements = [
|
14
|
+
"fastapi",
|
15
|
+
"uvicorn",
|
16
|
+
"google-genai",
|
17
|
+
"azure-cognitiveservices-speech",
|
18
|
+
"letta-client",
|
19
|
+
"openai",
|
20
|
+
"pyyaml",
|
21
|
+
"pydantic",
|
22
|
+
"jinja2",
|
23
|
+
"python-multipart",
|
24
|
+
"mutagen",
|
25
|
+
]
|
19
26
|
|
20
27
|
setup(
|
21
28
|
name="neuro-simulator",
|
22
|
-
version="0.0.
|
29
|
+
version="0.0.3", # Updated version
|
23
30
|
author="Moha-Master",
|
24
31
|
author_email="hongkongreporter@outlook.com",
|
25
32
|
description="Neuro Simulator Server",
|
@@ -48,6 +55,6 @@ setup(
|
|
48
55
|
},
|
49
56
|
include_package_data=True,
|
50
57
|
package_data={
|
51
|
-
"neuro_simulator": ["
|
58
|
+
"neuro_simulator": ["config.yaml.example", "media/*"],
|
52
59
|
},
|
53
60
|
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{neuro_simulator-0.0.1 → neuro-simulator-0.0.3}/neuro_simulator.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|