neuro-simulator 0.0.2__tar.gz → 0.1.2__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 (40) hide show
  1. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/PKG-INFO +74 -91
  2. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/README.md +62 -76
  3. neuro_simulator-0.1.2/neuro_simulator/__init__.py +10 -0
  4. neuro_simulator-0.1.2/neuro_simulator/agent/__init__.py +8 -0
  5. neuro_simulator-0.1.2/neuro_simulator/agent/api.py +737 -0
  6. neuro_simulator-0.1.2/neuro_simulator/agent/core.py +471 -0
  7. neuro_simulator-0.1.2/neuro_simulator/agent/llm.py +104 -0
  8. neuro_simulator-0.1.2/neuro_simulator/agent/memory/__init__.py +4 -0
  9. neuro_simulator-0.1.2/neuro_simulator/agent/memory/manager.py +370 -0
  10. neuro_simulator-0.1.2/neuro_simulator/agent/memory.py +137 -0
  11. neuro_simulator-0.1.2/neuro_simulator/agent/tools/__init__.py +4 -0
  12. neuro_simulator-0.1.2/neuro_simulator/agent/tools/core.py +112 -0
  13. neuro_simulator-0.1.2/neuro_simulator/agent/tools.py +69 -0
  14. neuro_simulator-0.1.2/neuro_simulator/builtin_agent.py +83 -0
  15. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/cli.py +57 -12
  16. neuro_simulator-0.1.2/neuro_simulator/config.py +364 -0
  17. neuro_simulator-0.0.2/neuro_simulator/settings.yaml.example → neuro_simulator-0.1.2/neuro_simulator/config.yaml.example +16 -2
  18. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/letta.py +75 -46
  19. neuro_simulator-0.1.2/neuro_simulator/log_handler.py +43 -0
  20. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/main.py +177 -30
  21. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/process_manager.py +5 -2
  22. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/stream_manager.py +6 -0
  23. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator.egg-info/PKG-INFO +74 -91
  24. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator.egg-info/SOURCES.txt +13 -2
  25. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator.egg-info/requires.txt +6 -0
  26. neuro_simulator-0.1.2/pyproject.toml +58 -0
  27. neuro_simulator-0.0.2/neuro_simulator/__init__.py +0 -1
  28. neuro_simulator-0.0.2/neuro_simulator/config.py +0 -226
  29. neuro_simulator-0.0.2/neuro_simulator/log_handler.py +0 -29
  30. neuro_simulator-0.0.2/setup.py +0 -60
  31. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/audio_synthesis.py +0 -0
  32. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/chatbot.py +0 -0
  33. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/media/neuro_start.mp4 +0 -0
  34. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/shared_state.py +0 -0
  35. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/stream_chat.py +0 -0
  36. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator/websocket_manager.py +0 -0
  37. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator.egg-info/dependency_links.txt +0 -0
  38. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator.egg-info/entry_points.txt +0 -0
  39. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/neuro_simulator.egg-info/top_level.txt +0 -0
  40. {neuro_simulator-0.0.2 → neuro_simulator-0.1.2}/setup.cfg +0 -0
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.4
2
- Name: neuro-simulator
3
- Version: 0.0.2
2
+ Name: neuro_simulator
3
+ Version: 0.1.2
4
4
  Summary: Neuro Simulator Server
5
- Home-page: https://github.com/Moha-Master/neuro-simulator
6
- Author: Moha-Master
7
- Author-email: hongkongreporter@outlook.com
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
8
10
  Classifier: Development Status :: 4 - Beta
9
11
  Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
12
  Classifier: Operating System :: OS Independent
12
13
  Classifier: Programming Language :: Python :: 3
13
14
  Classifier: Programming Language :: Python :: 3.8
@@ -28,33 +29,27 @@ Requires-Dist: pydantic
28
29
  Requires-Dist: jinja2
29
30
  Requires-Dist: python-multipart
30
31
  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
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"
40
37
 
41
38
  # Neuro-Simulator 服务端
42
39
 
43
- *关注Vedal喵,关注Vedal谢谢喵*
44
-
45
40
  *本临时README由AI自动生成*
46
41
 
47
- 这是 Neuro Simulator 的后端服务,基于 Python 和 FastAPI 构建,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
42
+ 这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
48
43
 
49
44
  ## 功能特性
50
45
 
51
- - **多 LLM 支持**:支持 Gemini 和 OpenAI API,用于生成观众聊天内容
46
+ - **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
52
47
  - **配置管理**:支持通过 API 动态修改和热重载配置
53
48
  - **外部控制**:完全使用外部API端点操控服务端运行
54
49
 
55
50
  ## 目录结构
56
51
 
57
- ```
52
+ ``` main
58
53
  neuro_simulator/
59
54
  ├── main.py # 应用入口和核心逻辑
60
55
  ├── config.py # 配置管理模块
@@ -68,87 +63,73 @@ neuro_simulator/
68
63
  ├── shared_state.py # 全局状态管理
69
64
  ├── log_handler.py # 日志处理模块
70
65
  ├── requirements.txt # Python 依赖列表
71
- ├── setup.py # Python 包安装配置
66
+ ├── pyproject.toml # Python 包安装配置
72
67
  ├── cli.py # 命令行启动脚本
73
- ├── settings.yaml.example # 自带的备用配置模板
68
+ ├── config.yaml.example # 自带的备用配置模板
74
69
  └── media/ # 自带的备用媒体文件
75
-    └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
70
+ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
76
71
  ```
77
72
 
78
- ```
79
- working_dir_example/ # 工作目录结构
73
+ ``` workin'dir
74
+ working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
80
75
  ├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
81
-    └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
82
- ├── settings.yaml # 由用户手工创建的配置文件
83
- └── settings.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
76
+ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
77
+ ├── config.yaml # 由用户手工创建的配置文件
78
+ └── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
84
79
  ```
85
80
 
86
81
  ## 安装与配置
87
82
 
88
- 0. **配置设置**
89
- 复制一份 `working_dir_example` 到你想要的位置,作为配置文件目录
90
- 然后进入配置文件目录,复制 `settings.yaml.example` `settings.yaml`
91
- 编辑 `settings.yaml` 文件,填入必要的 API 密钥和配置项:
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 密钥和配置项:
92
88
  - Letta Token 和 Agent ID
93
89
  - Gemini/OpenAI API Key
94
90
  - Azure TTS Key 和 Region
95
- 可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件
96
-
97
- ### 方法一:使用 pip 安装
98
-
99
- 1. **从云端安装PyPi包,适合直接使用**
100
- ```bash
101
- python3 -m venv venv
102
- # Windows
103
- venv/Scripts/pip install neuro-simulator
104
- # macOS/Linux
105
- venv/bin/pip install neuro-simulator
106
- ```
107
-
108
- **从本地安装PyPi包,适合二次开发**
109
- ```bash
110
- python3 -m venv venv
111
- #Windows
112
- venv/Scripts/pip install -e .
113
- # macOS/Linux
114
- venv/bin/pip install -e .
115
- ```
116
-
117
- 2. **运行服务**
118
- ```bash
119
- # 使用默认配置 (~/.config/neuro-simulator/)
120
- neuro
121
-
122
- # 指定工作目录
123
- neuro -D /path/to/your/config
124
-
125
- # 指定主机和端口
126
- neuro -H 0.0.0.0 -P 8080
127
-
128
- # 组合使用
129
- neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
130
- ```
131
-
132
- ### 方法二:传统方式运行
133
-
134
- 1. **创建并激活虚拟环境**
135
- ```bash
136
- python -m venv venv
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
- ```
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
+ ```
152
133
 
153
134
  服务默认运行在 `http://127.0.0.1:8000`。
154
135
 
@@ -169,7 +150,7 @@ working_dir_example/ # 工作目录结构
169
150
 
170
151
  ## 配置说明
171
152
 
172
- 配置文件 `settings.yaml` 包含以下主要配置项:
153
+ 配置文件 `config.yaml` 包含以下主要配置项:
173
154
 
174
155
  - `api_keys` - 各种服务的 API 密钥
175
156
  - `stream_metadata` - 直播元数据(标题、分类、标签等)
@@ -179,11 +160,13 @@ working_dir_example/ # 工作目录结构
179
160
  - `performance` - 性能相关设置
180
161
  - `server` - 服务器设置(主机、端口、CORS 等)
181
162
 
163
+ 有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
164
+
182
165
  ## 安全说明
183
166
 
184
167
  1. 通过 `panel_password` 配置项可以设置控制面板访问密码
185
168
  2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
186
- 3. 支持 CORS,但仅允许预配置的来源访问
169
+ 3. 支持 CORS,仅允许预配置的来源访问
187
170
 
188
171
  ## 故障排除
189
172
 
@@ -1,20 +1,18 @@
1
1
  # Neuro-Simulator 服务端
2
2
 
3
- *关注Vedal喵,关注Vedal谢谢喵*
4
-
5
3
  *本临时README由AI自动生成*
6
4
 
7
- 这是 Neuro Simulator 的后端服务,基于 Python 和 FastAPI 构建,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
5
+ 这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
8
6
 
9
7
  ## 功能特性
10
8
 
11
- - **多 LLM 支持**:支持 Gemini 和 OpenAI API,用于生成观众聊天内容
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 # 配置管理模块
@@ -28,87 +26,73 @@ neuro_simulator/
28
26
  ├── shared_state.py # 全局状态管理
29
27
  ├── log_handler.py # 日志处理模块
30
28
  ├── requirements.txt # Python 依赖列表
31
- ├── setup.py # Python 包安装配置
29
+ ├── pyproject.toml # Python 包安装配置
32
30
  ├── cli.py # 命令行启动脚本
33
- ├── settings.yaml.example # 自带的备用配置模板
31
+ ├── config.yaml.example # 自带的备用配置模板
34
32
  └── media/ # 自带的备用媒体文件
35
-    └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
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
-    └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
42
- ├── settings.yaml # 由用户手工创建的配置文件
43
- └── settings.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
39
+ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
40
+ ├── config.yaml # 由用户手工创建的配置文件
41
+ └── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
44
42
  ```
45
43
 
46
44
  ## 安装与配置
47
45
 
48
- 0. **配置设置**
49
- 复制一份 `working_dir_example` 到你想要的位置,作为配置文件目录
50
- 然后进入配置文件目录,复制 `settings.yaml.example` `settings.yaml`
51
- 编辑 `settings.yaml` 文件,填入必要的 API 密钥和配置项:
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 密钥和配置项:
52
51
  - Letta Token 和 Agent ID
53
52
  - Gemini/OpenAI API Key
54
53
  - Azure TTS Key 和 Region
55
- 可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件
56
-
57
- ### 方法一:使用 pip 安装
58
-
59
- 1. **从云端安装PyPi包,适合直接使用**
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
- **从本地安装PyPi包,适合二次开发**
69
- ```bash
70
- python3 -m venv venv
71
- #Windows
72
- venv/Scripts/pip install -e .
73
- # macOS/Linux
74
- venv/bin/pip install -e .
75
- ```
76
-
77
- 2. **运行服务**
78
- ```bash
79
- # 使用默认配置 (~/.config/neuro-simulator/)
80
- neuro
81
-
82
- # 指定工作目录
83
- neuro -D /path/to/your/config
84
-
85
- # 指定主机和端口
86
- neuro -H 0.0.0.0 -P 8080
87
-
88
- # 组合使用
89
- neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
90
- ```
91
-
92
- ### 方法二:传统方式运行
93
-
94
- 1. **创建并激活虚拟环境**
95
- ```bash
96
- python -m venv venv
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
- ```
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
+ ```
112
96
 
113
97
  服务默认运行在 `http://127.0.0.1:8000`。
114
98
 
@@ -129,7 +113,7 @@ working_dir_example/ # 工作目录结构
129
113
 
130
114
  ## 配置说明
131
115
 
132
- 配置文件 `settings.yaml` 包含以下主要配置项:
116
+ 配置文件 `config.yaml` 包含以下主要配置项:
133
117
 
134
118
  - `api_keys` - 各种服务的 API 密钥
135
119
  - `stream_metadata` - 直播元数据(标题、分类、标签等)
@@ -139,11 +123,13 @@ working_dir_example/ # 工作目录结构
139
123
  - `performance` - 性能相关设置
140
124
  - `server` - 服务器设置(主机、端口、CORS 等)
141
125
 
126
+ 有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
127
+
142
128
  ## 安全说明
143
129
 
144
130
  1. 通过 `panel_password` 配置项可以设置控制面板访问密码
145
131
  2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
146
- 3. 支持 CORS,但仅允许预配置的来源访问
132
+ 3. 支持 CORS,仅允许预配置的来源访问
147
133
 
148
134
  ## 故障排除
149
135
 
@@ -0,0 +1,10 @@
1
+ # neuro_simulator/__init__.py
2
+
3
+ # 导出主要模块以便于使用
4
+ from .builtin_agent import initialize_builtin_agent, get_builtin_response, reset_builtin_agent_memory
5
+
6
+ __all__ = [
7
+ "initialize_builtin_agent",
8
+ "get_builtin_response",
9
+ "reset_builtin_agent_memory"
10
+ ]
@@ -0,0 +1,8 @@
1
+ # agent/__init__.py
2
+ """
3
+ Agent module for Neuro Simulator Server
4
+ """
5
+
6
+ from .core import Agent
7
+
8
+ __all__ = ["Agent"]