jarvis-ai-assistant 0.1.47__py3-none-any.whl → 0.1.49__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- jarvis/__init__.py +1 -1
- jarvis/agent.py +1 -0
- jarvis/main.py +7 -1
- jarvis/models/oyi.py +28 -22
- {jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/RECORD +10 -10
- {jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/agent.py
CHANGED
jarvis/main.py
CHANGED
@@ -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())
|
jarvis/models/oyi.py
CHANGED
@@ -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
|
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
|
-
|
273
|
-
|
274
|
-
|
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
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
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
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
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"文件上传失败: {
|
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,13 +1,13 @@
|
|
1
|
-
jarvis/__init__.py,sha256=
|
2
|
-
jarvis/agent.py,sha256=
|
3
|
-
jarvis/main.py,sha256=
|
1
|
+
jarvis/__init__.py,sha256=Xg7aYAhPVxCV5eg57RCpDNiyuP8Kotb_IGSd9paURE0,50
|
2
|
+
jarvis/agent.py,sha256=7-1rkU_jEAolZvx_FtbN_o91Rp2G3L0hgkBXwOMWmCk,12322
|
3
|
+
jarvis/main.py,sha256=VIqMYnqNrmVcnO5YC-Tc-ATVBt8IlqIcXHjZvHmyCFs,6272
|
4
4
|
jarvis/utils.py,sha256=JlkuC9RtspXH2VWDmj9nR0vnb8ie1gIsKc4vC7WRco8,7321
|
5
5
|
jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
|
6
6
|
jarvis/models/ai8.py,sha256=9i7n_-TPbvq0AaRILs9ERQ7Vy5tDyoibXkiPsJvwQio,12520
|
7
7
|
jarvis/models/base.py,sha256=eeNJJbv9ikPVTtV_E7mgW8LZzVgjQ-OzxlHF6slYrHw,1237
|
8
8
|
jarvis/models/kimi.py,sha256=N0bPQ1ugx0RwjR96jLchmOPvCmws-fXyA0mnOAdo2k4,17161
|
9
9
|
jarvis/models/openai.py,sha256=pB7AaZuorHlmudTPaUnEbFOyl51Fy6uhU9KQBm98Ov8,4156
|
10
|
-
jarvis/models/oyi.py,sha256=
|
10
|
+
jarvis/models/oyi.py,sha256=4_sppGOLS3rucBHinhzjLhSh_6rJKIgLu9h6trHIOGM,14900
|
11
11
|
jarvis/models/registry.py,sha256=iVBjN9ImEvGHcz8WR-z8pPMJQZI907o_nccVOFANhak,7951
|
12
12
|
jarvis/tools/__init__.py,sha256=Kj1bKj34lwRDKMKHLOrLyQElf2lHbqA2tDgP359eaDo,71
|
13
13
|
jarvis/tools/base.py,sha256=EGRGbdfbLXDLwtyoWdvp9rlxNX7bzc20t0Vc2VkwIEY,652
|
@@ -17,9 +17,9 @@ jarvis/tools/methodology.py,sha256=G3cOaHTMujGZBhDLhQEqyCV2NISizO3MXRuho1KfI6Y,5
|
|
17
17
|
jarvis/tools/registry.py,sha256=NbH7A4A2lyN2IoyZGFwa5Ghed2dpzbJWCAd1Dg95WBI,7183
|
18
18
|
jarvis/tools/shell.py,sha256=UPKshPyOaUwTngresUw-ot1jHjQIb4wCY5nkJqa38lU,2520
|
19
19
|
jarvis/tools/sub_agent.py,sha256=rEtAmSVY2ZjFOZEKr5m5wpACOQIiM9Zr_3dT92FhXYU,2621
|
20
|
-
jarvis_ai_assistant-0.1.
|
21
|
-
jarvis_ai_assistant-0.1.
|
22
|
-
jarvis_ai_assistant-0.1.
|
23
|
-
jarvis_ai_assistant-0.1.
|
24
|
-
jarvis_ai_assistant-0.1.
|
25
|
-
jarvis_ai_assistant-0.1.
|
20
|
+
jarvis_ai_assistant-0.1.49.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
21
|
+
jarvis_ai_assistant-0.1.49.dist-info/METADATA,sha256=rzji5ek1C-KVdhBPtN3PZiVtFB6ea8BIXonLNEokWLQ,10015
|
22
|
+
jarvis_ai_assistant-0.1.49.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
23
|
+
jarvis_ai_assistant-0.1.49.dist-info/entry_points.txt,sha256=iKu7OMfew9dtfGhW71gIMTg4wvafuPqKb4wyQOnMAGU,44
|
24
|
+
jarvis_ai_assistant-0.1.49.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
25
|
+
jarvis_ai_assistant-0.1.49.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{jarvis_ai_assistant-0.1.47.dist-info → jarvis_ai_assistant-0.1.49.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|