neuro-simulator 0.0.2__py3-none-any.whl → 0.0.3__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/cli.py CHANGED
@@ -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 settings.yaml")
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 settings.yaml.example
32
- settings_example_path = work_dir / "settings.yaml.example"
33
- settings_path = work_dir / "settings.yaml"
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 settings.yaml.example from package if it doesn't exist
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', 'settings.yaml.example')
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 / "settings.yaml.example"
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: settings.yaml.example not found in package or development folder")
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 / "settings.yaml.example"
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: settings.yaml.example not found in package or development folder")
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 settings.yaml.example from package: {e}")
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 settings.yaml (required for running)
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.")
neuro_simulator/config.py CHANGED
@@ -88,7 +88,7 @@ class AppSettings(BaseModel):
88
88
 
89
89
  # --- 2. 加载和管理配置的逻辑 ---
90
90
 
91
- CONFIG_FILE_PATH = "settings.yaml"
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 settings.yaml.example.")
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 settings.yaml: {', '.join(missing_keys)}. "
145
- f"Please check your settings.yaml file against settings.yaml.example.")
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 settings.yaml."""
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.4
1
+ Metadata-Version: 2.1
2
2
  Name: neuro-simulator
3
- Version: 0.0.2
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,33 @@ 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: azure-cognitiveservices-speech
20
21
  Requires-Dist: fastapi
21
- Requires-Dist: uvicorn
22
22
  Requires-Dist: google-genai
23
- Requires-Dist: azure-cognitiveservices-speech
23
+ Requires-Dist: jinja2
24
24
  Requires-Dist: letta-client
25
+ Requires-Dist: mutagen
25
26
  Requires-Dist: openai
26
- Requires-Dist: pyyaml
27
27
  Requires-Dist: pydantic
28
- Requires-Dist: jinja2
29
28
  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
29
+ Requires-Dist: pyyaml
30
+ Requires-Dist: uvicorn
40
31
 
41
32
  # Neuro-Simulator 服务端
42
33
 
43
- *关注Vedal喵,关注Vedal谢谢喵*
44
-
45
34
  *本临时README由AI自动生成*
46
35
 
47
- 这是 Neuro Simulator 的后端服务,基于 Python 和 FastAPI 构建,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
36
+ 这是 Neuro Simulator 的服务端,负责处理直播逻辑、AI 交互、TTS 合成等核心功能。
48
37
 
49
38
  ## 功能特性
50
39
 
51
- - **多 LLM 支持**:支持 Gemini 和 OpenAI API,用于生成观众聊天内容
40
+ - **动态观众**:调用无状态LLM,动态生成观众聊天内容,支持 Gemini 和 OpenAI API
52
41
  - **配置管理**:支持通过 API 动态修改和热重载配置
53
42
  - **外部控制**:完全使用外部API端点操控服务端运行
54
43
 
55
44
  ## 目录结构
56
45
 
57
- ```
46
+ ``` main
58
47
  neuro_simulator/
59
48
  ├── main.py # 应用入口和核心逻辑
60
49
  ├── config.py # 配置管理模块
@@ -70,85 +59,70 @@ neuro_simulator/
70
59
  ├── requirements.txt # Python 依赖列表
71
60
  ├── setup.py # Python 包安装配置
72
61
  ├── cli.py # 命令行启动脚本
73
- ├── settings.yaml.example # 自带的备用配置模板
62
+ ├── config.yaml.example # 自带的备用配置模板
74
63
  └── media/ # 自带的备用媒体文件
75
-    └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
64
+ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
76
65
  ```
77
66
 
78
- ```
79
- working_dir_example/ # 工作目录结构
67
+ ``` workin'dir
68
+ working_dir_example/ # 工作目录结构,请将这个目录重命名和复制到你想要的位置(推荐放到~/.config/neuro-simulator)
80
69
  ├── media/ # 媒体文件夹,如缺失会使用自带资源覆盖
81
-    └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长
82
- ├── settings.yaml # 由用户手工创建的配置文件
83
- └── settings.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
70
+ └── neuro_start.mp4 # 用来计算Start Soon长度,仅读取时长,请和客户端的视频保持一致
71
+ ├── config.yaml # 由用户手工创建的配置文件
72
+ └── config.yaml.example # 自动生成的配置文件模板,必须手动重命名和填写
84
73
  ```
85
74
 
86
75
  ## 安装与配置
87
76
 
88
- 0. **配置设置**
89
- 复制一份 `working_dir_example` 到你想要的位置,作为配置文件目录
90
- 然后进入配置文件目录,复制 `settings.yaml.example` 到 `settings.yaml`
91
- 编辑 `settings.yaml` 文件,填入必要的 API 密钥和配置项:
77
+ 0. **在运行server前,必须有已经配置完成的Letta Agent。**
78
+ 1. 复制一份 `../docs/working_dir_example` 到你想要的位置,作为配置文件目录
79
+ 2. 然后进入配置文件目录,复制 `config.yaml.example` 到 `config.yaml`
80
+ 3. 编辑 `config.yaml` 文件,填入必要的 API 密钥和配置项:
92
81
  - Letta Token 和 Agent ID
93
82
  - Gemini/OpenAI API Key
94
83
  - 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
- ```
84
+
85
+ 可以执行替换media/neuro_start.mp4为其它视频文件,但记得手动替换client中的同名文件。
86
+
87
+ ### 直接安装方式(无需二次开发)
88
+
89
+ 若无需二次开发,可以直接使用pip安装:
90
+ ```bash
91
+ python3 -m venv venv
92
+ # Windows
93
+ venv/Scripts/pip install neuro-simulator
94
+ # macOS/Linux
95
+ venv/bin/pip install neuro-simulator
96
+ ```
97
+
98
+ ### 二次开发方式
99
+
100
+ 若需要二次开发,请克隆项目,在server下建立venv,然后pip install -e ./:
101
+ ```bash
102
+ git clone https://github.com/your-username/Neuro-Simulator.git
103
+ cd Neuro-Simulator/server
104
+ python3 -m venv venv
105
+ # Windows
106
+ venv/Scripts/pip install -e .
107
+ # macOS/Linux
108
+ venv/bin/pip install -e .
109
+ ```
110
+
111
+ ### 运行服务
112
+
113
+ ```bash
114
+ # 使用默认配置 (位于~/.config/neuro-simulator/)
115
+ neuro
116
+
117
+ # 指定工作目录
118
+ neuro -D /path/to/your/config
119
+
120
+ # 指定主机和端口
121
+ neuro -H 0.0.0.0 -P 8080
122
+
123
+ # 组合使用
124
+ neuro -D /path/to/your/config -H 0.0.0.0 -P 8080
125
+ ```
152
126
 
153
127
  服务默认运行在 `http://127.0.0.1:8000`。
154
128
 
@@ -169,7 +143,7 @@ working_dir_example/ # 工作目录结构
169
143
 
170
144
  ## 配置说明
171
145
 
172
- 配置文件 `settings.yaml` 包含以下主要配置项:
146
+ 配置文件 `config.yaml` 包含以下主要配置项:
173
147
 
174
148
  - `api_keys` - 各种服务的 API 密钥
175
149
  - `stream_metadata` - 直播元数据(标题、分类、标签等)
@@ -179,11 +153,13 @@ working_dir_example/ # 工作目录结构
179
153
  - `performance` - 性能相关设置
180
154
  - `server` - 服务器设置(主机、端口、CORS 等)
181
155
 
156
+ 有关配置文件的完整示例,请参阅项目根目录下的 `docs/working_dir_example/` 文件夹。
157
+
182
158
  ## 安全说明
183
159
 
184
160
  1. 通过 `panel_password` 配置项可以设置控制面板访问密码
185
161
  2. 敏感配置项(如 API 密钥)不会通过 API 接口暴露
186
- 3. 支持 CORS,但仅允许预配置的来源访问
162
+ 3. 支持 CORS,仅允许预配置的来源访问
187
163
 
188
164
  ## 故障排除
189
165
 
@@ -1,20 +1,20 @@
1
1
  neuro_simulator/__init__.py,sha256=JJWUFh_lBowSfGMhmC9zixE70cB7GG1pTbjGY4Kg3mU,29
2
2
  neuro_simulator/audio_synthesis.py,sha256=fwS0car42-aheCFVQDgRpUTnqLv4DU9Re66PCa6zTBM,2938
3
3
  neuro_simulator/chatbot.py,sha256=qQamPO5QTPwV1avNXrzjZpiJlWN3X_6vxSZPSA17jb0,5152
4
- neuro_simulator/cli.py,sha256=uMN9N6n69ceBRwACQ67-reDTB4mEY7RTgBD2choO_BU,6002
5
- neuro_simulator/config.py,sha256=rnosgBCJ2waKB7F63paT0aRnWsda_bvmyHdzOTvIW_0,9625
4
+ neuro_simulator/cli.py,sha256=gf_9Ar_uIodL8O2ZhrXhtXXFJzaQ6QCEzWoQub-JOeI,5978
5
+ neuro_simulator/config.py,sha256=7ek1hKi4mxTRv1IdrkkFgY8Hb_JaPL8a637z71TKHpw,9613
6
+ neuro_simulator/config.yaml.example,sha256=uywVEnoFZGZ4g6qdp616Qoi78F2AF21rSG99gtFiY-s,6003
6
7
  neuro_simulator/letta.py,sha256=F0PbnL9vmcznxwkTQKiK9PoGsp42FbCpSbiDuFdjUWo,6475
7
8
  neuro_simulator/log_handler.py,sha256=JlCtJ7wJ0pruVGVO5u-kz-F5uaYhlBl4H5xoGUFhT18,1079
8
9
  neuro_simulator/main.py,sha256=NlYM9OSv9sxmDIP7KEPOFyDRsU8VlQ2ngqNoNMo9CAE,22043
9
10
  neuro_simulator/process_manager.py,sha256=KqW11PRJR5e4RSBytaZdkgbd3wxRtWqlz6D0TA4oR1s,2492
10
- neuro_simulator/settings.yaml.example,sha256=uywVEnoFZGZ4g6qdp616Qoi78F2AF21rSG99gtFiY-s,6003
11
11
  neuro_simulator/shared_state.py,sha256=cvYg8vGrkuDmb0e-4J1xvIjXVwspRisuxQaIR9YgsyQ,459
12
12
  neuro_simulator/stream_chat.py,sha256=X655rrOW8oQ77qAFK-dQDhHT3bYiE9w44a9Na_ikM2w,997
13
13
  neuro_simulator/stream_manager.py,sha256=vA88HQGgYguFb3_GUDSY-FpTG0rsjt8J-JFtMoCWWCo,6720
14
14
  neuro_simulator/websocket_manager.py,sha256=a9mMAN7xmgK2w9tVDOOzy4DuWSwdAPatSp6bW9fhE3I,2183
15
15
  neuro_simulator/media/neuro_start.mp4,sha256=xCLnNzv4THnzRYwkdV6EiqXc-XtFd867R2ZVLDvNp0Y,8226418
16
- neuro_simulator-0.0.2.dist-info/METADATA,sha256=jO9a2MAGwDl9K1wYNxvRxuEKQKz3zq61NbV3QAXxaps,6152
17
- neuro_simulator-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- neuro_simulator-0.0.2.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
19
- neuro_simulator-0.0.2.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
20
- neuro_simulator-0.0.2.dist-info/RECORD,,
16
+ neuro_simulator-0.0.3.dist-info/METADATA,sha256=aB8eWL6ZQKWQyS4b7xqMHh8Pyg3yOn0FvjM7Mzpe-F8,5940
17
+ neuro_simulator-0.0.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
18
+ neuro_simulator-0.0.3.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
19
+ neuro_simulator-0.0.3.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
20
+ neuro_simulator-0.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5