jarvis-ai-assistant 0.1.119__py3-none-any.whl → 0.1.120__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.

Potentially problematic release.


This version of jarvis-ai-assistant might be problematic. Click here for more details.

jarvis/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.119"
3
+ __version__ = "0.1.120"
@@ -21,23 +21,20 @@ class PatchOutputHandler(OutputHandler):
21
21
 
22
22
  def prompt(self) -> str:
23
23
  return """
24
- # 📝 Code Modification Format
25
- Use specific blocks for different operations:
26
-
27
24
  # 🔄 REPLACE: Modify existing code
28
25
  <REPLACE>
29
26
  File: path/to/file
30
27
  Lines: [start,end] or [start,end)
31
- -----
32
- new_content
28
+ [new content]
29
+ ...
33
30
  </REPLACE>
34
31
 
35
32
  # ➕ INSERT: Add new code
36
33
  <INSERT>
37
34
  File: path/to/file
38
35
  Line: position
39
- -----
40
- new_content
36
+ [new content]
37
+ ...
41
38
  </INSERT>
42
39
 
43
40
  # 🗑️ DELETE: Remove existing code
@@ -49,8 +46,8 @@ Lines: [start,end] or [start,end)
49
46
  # 🆕 NEW_FILE: Create new file
50
47
  <NEW_FILE>
51
48
  File: path/to/file
52
- -----
53
- new_content
49
+ [new content]
50
+ ...
54
51
  </NEW_FILE>
55
52
 
56
53
  # ➡️ MOVE_FILE: Relocate a file
@@ -77,7 +74,6 @@ File: path/to/file
77
74
  - Omit for NEW_FILE/REMOVE_FILE
78
75
 
79
76
  3. Content
80
- - Use "-----" separator
81
77
  - Maintain original indentation
82
78
  - Follow existing code style
83
79
 
@@ -86,7 +82,6 @@ File: path/to/file
86
82
  <REPLACE>
87
83
  File: src/utils.py
88
84
  Lines: [9,13]
89
- -----
90
85
  def updated_function():
91
86
  # Replaces lines 9-13 inclusive
92
87
  return "new_implementation"
@@ -96,7 +91,6 @@ def updated_function():
96
91
  <REPLACE>
97
92
  File: src/calculator.py
98
93
  Lines: [5,8)
99
- -----
100
94
  def new_calculation():
101
95
  # Replaces lines 5-7 (excludes line 8)
102
96
  return 42
@@ -106,7 +100,6 @@ def new_calculation():
106
100
  <INSERT>
107
101
  File: src/main.py
108
102
  Line: 19
109
- -----
110
103
  # Inserted before line 19
111
104
  new_feature()
112
105
  </INSERT>
@@ -114,7 +107,6 @@ Line: 19
114
107
  ## NEW_FILE Example
115
108
  <NEW_FILE>
116
109
  File: src/new_module.py
117
- -----
118
110
  # New file creation
119
111
  def feature_entry():
120
112
  pass
@@ -204,9 +196,20 @@ def _parse_patch(patch_str: str) -> Dict[str, List[Dict[str, Any]]]:
204
196
  else:
205
197
  continue
206
198
 
207
- # Get content (after separator)
208
- separator_index = next((i for i, line in enumerate(lines) if line.strip() == "-----"), -1)
209
- content = '\n'.join(lines[separator_index + 1:]) if separator_index != -1 else ''
199
+ # Get content (after metadata)
200
+ if patch_type in ['REPLACE', 'DELETE']:
201
+ content_start = 2 # File + Lines
202
+ elif patch_type == 'INSERT':
203
+ content_start = 2 # File + Line
204
+ elif patch_type == 'NEW_FILE':
205
+ content_start = 1 # File
206
+ elif patch_type == 'MOVE_FILE':
207
+ content_start = 2 # File + NewPath
208
+ elif patch_type == 'REMOVE_FILE':
209
+ content_start = 1 # File
210
+
211
+ content_lines = lines[content_start:]
212
+ content = '\n'.join(content_lines).strip()
210
213
 
211
214
  if filepath not in result:
212
215
  result[filepath] = []
@@ -364,6 +367,9 @@ def handle_code_operation(filepath: str, patch: Dict[str, Any]):
364
367
  end_line = patch.get('end_line', 0)
365
368
  new_content = patch.get('content', '').splitlines(keepends=True)
366
369
 
370
+ if not new_content:
371
+ new_content = ['']
372
+
367
373
  PrettyOutput.print(f"patch_type: {patch_type}\nstart_line: {start_line}\nend_line: {end_line}\nnew_content:\n{new_content}", OutputType.INFO)
368
374
 
369
375
  if new_content and new_content[-1] and new_content[-1][-1] != '\n':
@@ -45,9 +45,22 @@ class BasePlatform(ABC):
45
45
  duration = end_time - start_time
46
46
  char_count = len(response)
47
47
 
48
+ # Calculate token count and tokens per second
49
+ try:
50
+ from jarvis.jarvis_utils import get_context_token_count
51
+ token_count = get_context_token_count(response)
52
+ tokens_per_second = token_count / duration if duration > 0 else 0
53
+ except Exception as e:
54
+ PrettyOutput.print(f"Tokenization failed: {str(e)}", OutputType.WARNING)
55
+ token_count = 0
56
+ tokens_per_second = 0
57
+
48
58
  # Print statistics
49
- PrettyOutput.print(f"对话完成 - 耗时: {duration:.2f}秒, 输出字符数: {char_count}", OutputType.INFO)
50
-
59
+ PrettyOutput.print(
60
+ f"对话完成 - 耗时: {duration:.2f}秒, 输出字符数: {char_count}, 输出Token数量: {token_count}, 每秒Token数量: {tokens_per_second:.2f}",
61
+ OutputType.INFO,
62
+ )
63
+
51
64
  # Keep original think tag handling
52
65
  response = re.sub(r'<<think>>.*?</</think>>', '', response, flags=re.DOTALL)
53
66
  return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.119
3
+ Version: 0.1.120
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
@@ -1,10 +1,10 @@
1
- jarvis/__init__.py,sha256=HwpqO7gDhgMRv9lqXELtgo1mrM7LBNbBitORgvnwpCs,51
1
+ jarvis/__init__.py,sha256=WXicnhWkcCvbf7sM1SBpoWQnsc4VhXTtp1qmcSLHA_g,51
2
2
  jarvis/jarvis_agent/__init__.py,sha256=V9sQJq-ygUQBvlfqcndkiGsOZd0fKf-mbB2PThK5k9E,22441
3
3
  jarvis/jarvis_agent/output_handler.py,sha256=kJeFTjjSu0K_2p0wyhq2veSZuhRXoaFC_8wVaoBKX0w,401
4
4
  jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  jarvis/jarvis_code_agent/code_agent.py,sha256=8bOvUtMqq6CvL-SkLOfdJl0DrPQB1G5YN7dJN_bkZrc,7046
6
6
  jarvis/jarvis_code_agent/file_select.py,sha256=Kfjed4Kfa142dpuq0a6jxWM-v2JwWG1BTwwjlC1BJgc,11754
7
- jarvis/jarvis_code_agent/patch.py,sha256=ZpUR3YzHenlL-QrlGAS7Bb2e0fFpijMfCvcwiwY0Tcg,13043
7
+ jarvis/jarvis_code_agent/patch.py,sha256=S4UbHupNUbkx3QrygOm1i0Ynz-w_56jfVURKfYPCw3c,13306
8
8
  jarvis/jarvis_code_agent/relevant_files.py,sha256=u9wae9sn-XLaUoSK69-LRLomHWcE-K1y7W10BFdmQVE,3402
9
9
  jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  jarvis/jarvis_codebase/main.py,sha256=bvyYACCBNTrlJvaUCcJAJ8gUklKjy2HrMEfKjGYKtVQ,39779
@@ -18,7 +18,7 @@ jarvis/jarvis_lsp/rust.py,sha256=ZvUoOZm9GWLl3kobfByBuTGrQ8aM2dLuNxS_NHr1aQQ,554
18
18
  jarvis/jarvis_multi_agent/__init__.py,sha256=Z6QaRZrqUUa6r6Pe_KZi34Ymle5amQe1N-AINxiOi1c,6011
19
19
  jarvis/jarvis_platform/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
20
20
  jarvis/jarvis_platform/ai8.py,sha256=AO42OVzrwQMDY74TR2B4gtrsfeRVxJRf5OmHBM3cVQY,11948
21
- jarvis/jarvis_platform/base.py,sha256=YN8Y0B-8z-kdQg30dYQfX_9a0IOAfvJlb15V0CSWUkQ,2975
21
+ jarvis/jarvis_platform/base.py,sha256=HXUAa-Had4r_-4mAtOrF1bPxv7YPUGzvyXuPfomrfIQ,3576
22
22
  jarvis/jarvis_platform/kimi.py,sha256=WCRyG7jnqnpHNu6M9_pGFE_RBVKqYDtd_F1EPdT_FKU,15761
23
23
  jarvis/jarvis_platform/ollama.py,sha256=TsBEg8crPmBiLvMRDtXYVa2AIdeog36MmW2tn5j9x8U,5613
24
24
  jarvis/jarvis_platform/openai.py,sha256=rHzc20Frd5LzS0Wm97FxglSai65UKkY2ju8rg6q-gOg,4445
@@ -57,9 +57,9 @@ jarvis/jarvis_tools/search.py,sha256=NHrFpAqg6dtws_9wLJvIZimjeJ-kekETi0Bg0AWMG08
57
57
  jarvis/jarvis_tools/select_code_files.py,sha256=vbEdneWWtAN90OFASohtllTgZW400ZxQbrkgroPK1qc,1902
58
58
  jarvis/jarvis_tools/tool_generator.py,sha256=jdniHyKcEyF9KyouudrCoZBH3czZmQXc3ns0_trZ3yU,6332
59
59
  jarvis/jarvis_utils/__init__.py,sha256=utMWglhmeTc6YagV_BY3X-SkvhwjT13GUAbby7tGJ4Y,29911
60
- jarvis_ai_assistant-0.1.119.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
61
- jarvis_ai_assistant-0.1.119.dist-info/METADATA,sha256=BvkmoVyecDqDdYErZyaojB2DvRrxcqBltB4Gkdd4P3Q,13701
62
- jarvis_ai_assistant-0.1.119.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
63
- jarvis_ai_assistant-0.1.119.dist-info/entry_points.txt,sha256=H9Y_q7BZGDsgJijaXHD9GbscllATyKYfg22otrpKEoE,619
64
- jarvis_ai_assistant-0.1.119.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
65
- jarvis_ai_assistant-0.1.119.dist-info/RECORD,,
60
+ jarvis_ai_assistant-0.1.120.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
61
+ jarvis_ai_assistant-0.1.120.dist-info/METADATA,sha256=v6tHk0aRBdLovk6oSRHn71341o6hRXJdvYsV2PsXUbk,13701
62
+ jarvis_ai_assistant-0.1.120.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
63
+ jarvis_ai_assistant-0.1.120.dist-info/entry_points.txt,sha256=H9Y_q7BZGDsgJijaXHD9GbscllATyKYfg22otrpKEoE,619
64
+ jarvis_ai_assistant-0.1.120.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
65
+ jarvis_ai_assistant-0.1.120.dist-info/RECORD,,