jarvis-ai-assistant 0.1.47__tar.gz → 0.1.49__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. {jarvis_ai_assistant-0.1.47/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.49}/PKG-INFO +1 -1
  2. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/pyproject.toml +1 -1
  3. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/setup.py +1 -1
  4. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/__init__.py +1 -1
  5. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/agent.py +1 -0
  6. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/main.py +7 -1
  7. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/oyi.py +28 -22
  8. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49/src/jarvis_ai_assistant.egg-info}/PKG-INFO +1 -1
  9. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/LICENSE +0 -0
  10. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/MANIFEST.in +0 -0
  11. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/README.md +0 -0
  12. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/setup.cfg +0 -0
  13. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/__init__.py +0 -0
  14. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/ai8.py +0 -0
  15. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/base.py +0 -0
  16. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/kimi.py +0 -0
  17. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/openai.py +0 -0
  18. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/models/registry.py +0 -0
  19. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/__init__.py +0 -0
  20. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/base.py +0 -0
  21. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/file_ops.py +0 -0
  22. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/generator.py +0 -0
  23. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/methodology.py +0 -0
  24. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/registry.py +0 -0
  25. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/shell.py +0 -0
  26. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/tools/sub_agent.py +0 -0
  27. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis/utils.py +0 -0
  28. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +0 -0
  29. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  30. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -0
  31. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis_ai_assistant.egg-info/requires.txt +0 -0
  32. {jarvis_ai_assistant-0.1.47 → jarvis_ai_assistant-0.1.49}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.47
3
+ Version: 0.1.49
4
4
  Summary: Jarvis: An AI assistant that uses tools to interact with the system
5
5
  Home-page: https://github.com/skyfireitdiy/Jarvis
6
6
  Author: skyfire
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jarvis-ai-assistant"
7
- version = "0.1.47"
7
+ version = "0.1.49"
8
8
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Your Name", email = "your.email@example.com" }]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="jarvis-ai-assistant",
5
- version="0.1.47",
5
+ version="0.1.49",
6
6
  author="skyfire",
7
7
  author_email="skyfireitdiy@hotmail.com",
8
8
  description="An AI assistant that uses various tools to interact with the system",
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.47"
3
+ __version__ = "0.1.49"
@@ -179,6 +179,7 @@ arguments:
179
179
  4. 不要创建虚假对话
180
180
  5. 如果现有信息不足以解决问题,则可以询问用户
181
181
  6. 处理问题的每个步骤不是必须有的,可按情况省略
182
+ 7. 在执行一些可能对系统或者用户代码库造成破坏的工具时,请先询问用户
182
183
 
183
184
  -------------------------------------------------------------
184
185
 
@@ -104,6 +104,7 @@ def main():
104
104
  parser.add_argument('-f', '--files', nargs='*', help='要处理的文件列表')
105
105
  parser.add_argument('--keep-history', action='store_true', help='保持聊天历史(不删除会话)')
106
106
  parser.add_argument('-p', '--platform', default='', help='选择AI平台')
107
+ parser.add_argument('-m', '--model', default='', help='模型') # 用于指定使用的模型名称,默认使用环境变量或平台默认模型
107
108
  args = parser.parse_args()
108
109
 
109
110
  load_env_from_file()
@@ -120,6 +121,11 @@ def main():
120
121
  # 获取全局模型实例
121
122
  agent = Agent()
122
123
 
124
+ # 如果用户传入了模型参数,则更换当前模型为用户指定的模型
125
+ if args.model:
126
+ PrettyOutput.print(f"用户传入了模型参数,更换模型: {args.model}", OutputType.USER)
127
+ agent.model.set_model_name(args.model)
128
+
123
129
  # 欢迎信息
124
130
  PrettyOutput.print(f"Jarvis 已初始化 - With {platform} 平台,模型: {agent.model.name()}", OutputType.SYSTEM)
125
131
  if args.keep_history:
@@ -151,4 +157,4 @@ def main():
151
157
  return 0
152
158
 
153
159
  if __name__ == "__main__":
154
- exit(main())
160
+ exit(main())
@@ -29,7 +29,7 @@ class OyiModel(BasePlatform):
29
29
  self.messages = []
30
30
  self.system_message = ""
31
31
  self.conversation = None
32
- self.upload_files = []
32
+ self.upload_files = [] # 重命名 files 为 upload_files
33
33
  self.first_chat = True
34
34
 
35
35
  self.token = os.getenv("OYI_API_KEY")
@@ -244,7 +244,7 @@ class OyiModel(BasePlatform):
244
244
  PrettyOutput.print(f"删除会话异常: {str(e)}", OutputType.ERROR)
245
245
  return False
246
246
 
247
- def upload_file(self, file_path: str) -> Dict:
247
+ def upload_files(self, file_list: List[str]) -> List[Dict]:
248
248
  """Upload a file to OYI API
249
249
 
250
250
  Args:
@@ -269,30 +269,36 @@ class OyiModel(BasePlatform):
269
269
  'Referer': 'https://ai.rcouyi.com/'
270
270
  }
271
271
 
272
- with open(file_path, 'rb') as f:
273
- files = {
274
- 'file': (os.path.basename(file_path), f, mimetypes.guess_type(file_path)[0])
275
- }
272
+ for file_path in file_list:
273
+ # 检查文件类型
274
+ file_type = mimetypes.guess_type(file_path)[0]
275
+ if not file_type or not file_type.startswith(('image/', 'text/', 'application/')):
276
+ PrettyOutput.print(f"文件类型不支持: {file_type}", OutputType.ERROR)
277
+ continue
276
278
 
277
- response = requests.post(
278
- f"{self.BASE_URL}/chatapi/m_file/uploadfile",
279
- headers=headers,
280
- files=files
281
- )
279
+ with open(file_path, 'rb') as f:
280
+ files = {
281
+ 'file': (os.path.basename(file_path), f, file_type)
282
+ }
282
283
 
283
- if response.status_code == 200:
284
- data = response.json()
285
- if data.get('code') == 200:
286
- PrettyOutput.print("文件上传成功", OutputType.SUCCESS)
287
- print(data)
288
- self.upload_files.append(data)
289
- return data
284
+ response = requests.post(
285
+ f"{self.BASE_URL}/chatapi/m_file/uploadfile",
286
+ headers=headers,
287
+ files=files
288
+ )
289
+
290
+ if response.status_code == 200:
291
+ data = response.json()
292
+ if data.get('code') == 200:
293
+ PrettyOutput.print("文件上传成功", OutputType.SUCCESS)
294
+ self.upload_files.append(data)
295
+ return data
296
+ else:
297
+ PrettyOutput.print(f"文件上传失败: {data.get('message')}", OutputType.ERROR)
298
+ return None
290
299
  else:
291
- PrettyOutput.print(f"文件上传失败: {data.get('message')}", OutputType.ERROR)
300
+ PrettyOutput.print(f"文件上传失败: {response.status_code}", OutputType.ERROR)
292
301
  return None
293
- else:
294
- PrettyOutput.print(f"文件上传失败: {response.status_code}", OutputType.ERROR)
295
- return None
296
302
 
297
303
  except Exception as e:
298
304
  PrettyOutput.print(f"文件上传异常: {str(e)}", OutputType.ERROR)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.47
3
+ Version: 0.1.49
4
4
  Summary: Jarvis: An AI assistant that uses tools to interact with the system
5
5
  Home-page: https://github.com/skyfireitdiy/Jarvis
6
6
  Author: skyfire