jarvis-ai-assistant 0.1.24__py3-none-any.whl → 0.1.26__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.
- jarvis/__init__.py +1 -1
- jarvis/__pycache__/__init__.cpython-313.pyc +0 -0
- jarvis/models/__pycache__/kimi.cpython-313.pyc +0 -0
- jarvis/models/kimi.py +22 -13
- jarvis/tools/__pycache__/base.cpython-313.pyc +0 -0
- jarvis/tools/base.py +1 -1
- {jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/RECORD +12 -12
- {jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
jarvis/models/kimi.py
CHANGED
|
@@ -10,7 +10,7 @@ import time
|
|
|
10
10
|
class KimiModel(BaseModel):
|
|
11
11
|
"""Kimi模型实现"""
|
|
12
12
|
|
|
13
|
-
def __init__(self, api_key: str, verbose: bool = False):
|
|
13
|
+
def __init__(self, api_key: Optional[str] = None, verbose: bool = False):
|
|
14
14
|
"""
|
|
15
15
|
初始化Kimi模型
|
|
16
16
|
Args:
|
|
@@ -42,14 +42,14 @@ class KimiModel(BaseModel):
|
|
|
42
42
|
self.chat_id = response.json()["id"]
|
|
43
43
|
return True
|
|
44
44
|
except Exception as e:
|
|
45
|
-
PrettyOutput.print(f"Failed to create chat: {e}", OutputType.ERROR)
|
|
45
|
+
PrettyOutput.print(f"Failed to create chat: {e}: Response: {response.text}", OutputType.ERROR)
|
|
46
46
|
return False
|
|
47
47
|
|
|
48
|
-
def _get_presigned_url(self, filename: str) -> Dict:
|
|
48
|
+
def _get_presigned_url(self, filename: str, action: str) -> Dict:
|
|
49
49
|
"""获取预签名上传URL"""
|
|
50
50
|
url = "https://kimi.moonshot.cn/api/pre-sign-url"
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
53
|
|
|
54
54
|
payload = json.dumps({
|
|
55
55
|
"action": action,
|
|
@@ -75,11 +75,11 @@ class KimiModel(BaseModel):
|
|
|
75
75
|
PrettyOutput.print(f"Failed to upload file: {e}", OutputType.ERROR)
|
|
76
76
|
return False
|
|
77
77
|
|
|
78
|
-
def _get_file_info(self, file_data: Dict, name: str) -> Dict:
|
|
78
|
+
def _get_file_info(self, file_data: Dict, name: str, file_type: str) -> Dict:
|
|
79
79
|
"""获取文件信息"""
|
|
80
80
|
url = "https://kimi.moonshot.cn/api/file"
|
|
81
81
|
payload = json.dumps({
|
|
82
|
-
"type":
|
|
82
|
+
"type": file_type,
|
|
83
83
|
"name": name,
|
|
84
84
|
"object_name": file_data["object_name"],
|
|
85
85
|
"chat_id": self.chat_id,
|
|
@@ -114,6 +114,7 @@ class KimiModel(BaseModel):
|
|
|
114
114
|
continue
|
|
115
115
|
|
|
116
116
|
line = line.decode('utf-8')
|
|
117
|
+
print(data)
|
|
117
118
|
if not line.startswith("data: "):
|
|
118
119
|
continue
|
|
119
120
|
|
|
@@ -149,25 +150,33 @@ class KimiModel(BaseModel):
|
|
|
149
150
|
for index, file_path in enumerate(file_list, 1):
|
|
150
151
|
try:
|
|
151
152
|
PrettyOutput.print(f"处理文件 [{index}/{len(file_list)}]: {file_path}", OutputType.PROGRESS)
|
|
153
|
+
|
|
154
|
+
mime_type, _ = mimetypes.guess_type(file_path)
|
|
155
|
+
action = "image" if mime_type and mime_type.startswith('image/') else "file"
|
|
152
156
|
|
|
153
157
|
# 获取预签名URL
|
|
154
158
|
PrettyOutput.print("获取上传URL...", OutputType.PROGRESS)
|
|
155
|
-
presigned_data = self._get_presigned_url(file_path)
|
|
159
|
+
presigned_data = self._get_presigned_url(file_path, action)
|
|
156
160
|
|
|
157
161
|
# 上传文件
|
|
158
162
|
PrettyOutput.print("上传文件内容...", OutputType.PROGRESS)
|
|
159
163
|
if self._upload_file(file_path, presigned_data["url"]):
|
|
160
164
|
# 获取文件信息
|
|
161
165
|
PrettyOutput.print("获取文件信息...", OutputType.PROGRESS)
|
|
162
|
-
file_info = self._get_file_info(presigned_data, os.path.basename(file_path))
|
|
163
|
-
|
|
166
|
+
file_info = self._get_file_info(presigned_data, os.path.basename(file_path), action)
|
|
164
167
|
# 等待文件解析
|
|
165
168
|
PrettyOutput.print("等待文件解析完成...", OutputType.PROGRESS)
|
|
166
|
-
|
|
169
|
+
|
|
170
|
+
# 只有文件需要解析
|
|
171
|
+
if action == "file":
|
|
172
|
+
if self._wait_for_parse(file_info["id"]):
|
|
173
|
+
uploaded_files.append(file_info)
|
|
174
|
+
PrettyOutput.print(f"✓ 文件处理成功: {file_path}", OutputType.SUCCESS)
|
|
175
|
+
else:
|
|
176
|
+
PrettyOutput.print(f"✗ 文件解析失败: {file_path}", OutputType.ERROR)
|
|
177
|
+
else:
|
|
167
178
|
uploaded_files.append(file_info)
|
|
168
179
|
PrettyOutput.print(f"✓ 文件处理成功: {file_path}", OutputType.SUCCESS)
|
|
169
|
-
else:
|
|
170
|
-
PrettyOutput.print(f"✗ 文件解析失败: {file_path}", OutputType.ERROR)
|
|
171
180
|
else:
|
|
172
181
|
PrettyOutput.print(f"✗ 文件上传失败: {file_path}", OutputType.ERROR)
|
|
173
182
|
|
|
Binary file
|
jarvis/tools/base.py
CHANGED
|
@@ -106,7 +106,7 @@ class ToolRegistry:
|
|
|
106
106
|
hasattr(item, 'parameters')):
|
|
107
107
|
|
|
108
108
|
# 实例化工具类,传入模型和输出处理器
|
|
109
|
-
tool_instance = item(model=KimiModel(self.verbose), register=self, output_handler=self.output_handler)
|
|
109
|
+
tool_instance = item(model=KimiModel(verbose=self.verbose), register=self, output_handler=self.output_handler)
|
|
110
110
|
|
|
111
111
|
# 注册工具
|
|
112
112
|
self.register_tool(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=9OHRsOGRDWhP3EJS60c3-iXj0x4fUS5VIIpMM1p7KH0,50
|
|
2
2
|
jarvis/agent.py,sha256=hfb3_62s8ZA6p5HZhoThn1J6lsyEtENEx1f5TnX26rY,9950
|
|
3
3
|
jarvis/main.py,sha256=5_8cFOMfHJskLYj4kIP6yRq589Rvn4oPk1yDE0iMNzQ,7806
|
|
4
4
|
jarvis/utils.py,sha256=YuY8zpfD2kgjjJyWcT62OCq3ADuFuqwStqXFTbq16o8,6603
|
|
5
|
-
jarvis/__pycache__/__init__.cpython-313.pyc,sha256=
|
|
5
|
+
jarvis/__pycache__/__init__.cpython-313.pyc,sha256=xkkgNtiHAmhRCRGa8pkI5gthH407tPH74ku_GWH7olI,209
|
|
6
6
|
jarvis/__pycache__/agent.cpython-313.pyc,sha256=PtH_PA_LT0ZjROfRdKFgjL0yTAsv_llnm7qW2n3RaV0,12885
|
|
7
7
|
jarvis/__pycache__/main.cpython-313.pyc,sha256=jVqTajUJ1gOKj2cyPWB-D5cddFvTMjeRYcKoSCF7Nws,10343
|
|
8
8
|
jarvis/__pycache__/models.cpython-313.pyc,sha256=uWuRIjGrY4YDB3dGW5PGDLWaS03et8g11O725TjY_eU,5960
|
|
@@ -11,18 +11,18 @@ jarvis/__pycache__/utils.cpython-313.pyc,sha256=zs6OSkLlBeTHuIrJoRfnzFdJ5VkcdrUm
|
|
|
11
11
|
jarvis/__pycache__/zte_llm.cpython-313.pyc,sha256=kMm9IGundGmOPqjsgrm9oIaWLDagYGCPRAaE3ipkc-0,5662
|
|
12
12
|
jarvis/models/__init__.py,sha256=B_IJFvKTaxdg19FAD1ea288tYp3-bRYRpkeGI0_OcBI,262
|
|
13
13
|
jarvis/models/base.py,sha256=GgVl5N0qDqn-yqRcX_PX3wHjogouE6GPFAWktG40cXg,403
|
|
14
|
-
jarvis/models/kimi.py,sha256=
|
|
14
|
+
jarvis/models/kimi.py,sha256=Kg-GCiRkO-YAfRLxUNAeugksK8JcaoJGx9NaMvTF2Pk,15488
|
|
15
15
|
jarvis/models/__pycache__/__init__.cpython-313.pyc,sha256=jAwySX4diR7EWM_alK75tiIb_J8bVfs4Bh_U3bdjDLo,534
|
|
16
16
|
jarvis/models/__pycache__/base.cpython-313.pyc,sha256=4I9KZlXHvTB7vENA9YWK4Fx0sns_KvIOtWqzE9y_-Co,1094
|
|
17
|
-
jarvis/models/__pycache__/kimi.cpython-313.pyc,sha256=
|
|
17
|
+
jarvis/models/__pycache__/kimi.cpython-313.pyc,sha256=7ZpjS1imnK8urSXnCr-Bz2MhMIdGCZRUCI1oz0sfF18,18018
|
|
18
18
|
jarvis/tools/__init__.py,sha256=AjmFYLXt-_ulZXdYiXya2fD7QCJ-RaK91PEZCNj-UbA,262
|
|
19
|
-
jarvis/tools/base.py,sha256=
|
|
19
|
+
jarvis/tools/base.py,sha256=zILvGZ-V5LH1Zicor4rpc9XZvZ9Q4y6kMauqNtn0_p8,7404
|
|
20
20
|
jarvis/tools/file_ops.py,sha256=KbQLVCCXw-MtJg-12iyMeVGu8BTtLq7Mk7fpVKau40U,4296
|
|
21
21
|
jarvis/tools/generator.py,sha256=qURQ2ct61tRaN-CNhnbpjoj7recGGjFWnQUteKvej_g,7430
|
|
22
22
|
jarvis/tools/shell.py,sha256=MWe9-BAGApbGJfR60XG4nElGYHNBnbdF9vsOQTnEZ4g,2989
|
|
23
23
|
jarvis/tools/sub_agent.py,sha256=jU0j__Y5ufBktxIF5qdT3NyLHnybE23c39QRj3oz5CI,3381
|
|
24
24
|
jarvis/tools/__pycache__/__init__.cpython-313.pyc,sha256=KC48FS57427navbkxZ0eDKLePMCH2BKc5vAIu0b8lFc,404
|
|
25
|
-
jarvis/tools/__pycache__/base.cpython-313.pyc,sha256=
|
|
25
|
+
jarvis/tools/__pycache__/base.cpython-313.pyc,sha256=NTatHbOlZpVFNJWhroIpJtJ6YZpUVsgs40-hhY8jL-4,10000
|
|
26
26
|
jarvis/tools/__pycache__/bing_search.cpython-313.pyc,sha256=1G_wPbk5wcQYh7H0drLIS2Aw0XOG2ZM8ztgfQaqu3P8,2031
|
|
27
27
|
jarvis/tools/__pycache__/calculator.cpython-313.pyc,sha256=C_qwTDGm6gc7QNxtPzPZXyStdKEintJVQIt5NMHQ8oY,4205
|
|
28
28
|
jarvis/tools/__pycache__/calculator_tool.cpython-313.pyc,sha256=PI4LZNDTPdSe3ffWDRovLZ-r-vF8Kl-n6xdGdFWiBpY,4296
|
|
@@ -37,9 +37,9 @@ jarvis/tools/__pycache__/user_confirmation.cpython-313.pyc,sha256=wK3Ev10lHSUSRv
|
|
|
37
37
|
jarvis/tools/__pycache__/user_input.cpython-313.pyc,sha256=JjTFOhObKsKF4Pn8KBRuKfV1_Ssj083fjU7Mfc_5z7c,2531
|
|
38
38
|
jarvis/tools/__pycache__/user_interaction.cpython-313.pyc,sha256=RuVZ-pmiPBDywY3efgXSfohMAciC1avMGPmBK5qlnew,3305
|
|
39
39
|
jarvis/tools/__pycache__/webpage.cpython-313.pyc,sha256=BjzSfnNzsKCrLETCcWjt32lNDLzwnjqcVGg4JfWd9OM,3008
|
|
40
|
-
jarvis_ai_assistant-0.1.
|
|
41
|
-
jarvis_ai_assistant-0.1.
|
|
42
|
-
jarvis_ai_assistant-0.1.
|
|
43
|
-
jarvis_ai_assistant-0.1.
|
|
44
|
-
jarvis_ai_assistant-0.1.
|
|
45
|
-
jarvis_ai_assistant-0.1.
|
|
40
|
+
jarvis_ai_assistant-0.1.26.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
41
|
+
jarvis_ai_assistant-0.1.26.dist-info/METADATA,sha256=p9er_0dmX2gEeAUs143JqAthnglF_F47q-DEq-jSGcg,10193
|
|
42
|
+
jarvis_ai_assistant-0.1.26.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
43
|
+
jarvis_ai_assistant-0.1.26.dist-info/entry_points.txt,sha256=iKu7OMfew9dtfGhW71gIMTg4wvafuPqKb4wyQOnMAGU,44
|
|
44
|
+
jarvis_ai_assistant-0.1.26.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
45
|
+
jarvis_ai_assistant-0.1.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{jarvis_ai_assistant-0.1.24.dist-info → jarvis_ai_assistant-0.1.26.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|