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

Files changed (32) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +26 -31
  3. jarvis/jarvis_agent/main.py +77 -0
  4. jarvis/jarvis_c2rust/c2rust.yaml +734 -0
  5. jarvis/jarvis_code_agent/builtin_input_handler.py +43 -0
  6. jarvis/jarvis_code_agent/code_agent.py +82 -156
  7. jarvis/jarvis_code_agent/file_input_handler.py +88 -0
  8. jarvis/jarvis_code_agent/patch.py +262 -80
  9. jarvis/jarvis_code_agent/shell_input_handler.py +8 -2
  10. jarvis/jarvis_dev/main.py +832 -740
  11. jarvis/jarvis_multi_agent/__init__.py +113 -92
  12. jarvis/jarvis_platform/registry.py +0 -1
  13. jarvis/jarvis_tools/create_sub_agent.py +1 -8
  14. jarvis/jarvis_tools/git_commiter.py +2 -1
  15. jarvis/jarvis_tools/read_code.py +143 -0
  16. jarvis/jarvis_tools/registry.py +35 -39
  17. jarvis/jarvis_tools/tool_generator.py +45 -17
  18. jarvis/jarvis_utils/__init__.py +17 -17
  19. jarvis/jarvis_utils/config.py +87 -51
  20. jarvis/jarvis_utils/embedding.py +49 -48
  21. jarvis/jarvis_utils/git_utils.py +34 -34
  22. jarvis/jarvis_utils/globals.py +26 -26
  23. jarvis/jarvis_utils/input.py +61 -45
  24. jarvis/jarvis_utils/methodology.py +22 -22
  25. jarvis/jarvis_utils/output.py +64 -64
  26. jarvis/jarvis_utils/utils.py +2 -2
  27. {jarvis_ai_assistant-0.1.128.dist-info → jarvis_ai_assistant-0.1.130.dist-info}/METADATA +1 -1
  28. {jarvis_ai_assistant-0.1.128.dist-info → jarvis_ai_assistant-0.1.130.dist-info}/RECORD +32 -27
  29. {jarvis_ai_assistant-0.1.128.dist-info → jarvis_ai_assistant-0.1.130.dist-info}/entry_points.txt +2 -0
  30. {jarvis_ai_assistant-0.1.128.dist-info → jarvis_ai_assistant-0.1.130.dist-info}/LICENSE +0 -0
  31. {jarvis_ai_assistant-0.1.128.dist-info → jarvis_ai_assistant-0.1.130.dist-info}/WHEEL +0 -0
  32. {jarvis_ai_assistant-0.1.128.dist-info → jarvis_ai_assistant-0.1.130.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  """
2
- Global Variables and Configuration Module
3
- This module manages global state and configurations for the Jarvis system.
4
- It includes:
5
- - Global agent management
6
- - Console configuration with custom theme
7
- - Environment initialization
2
+ 全局变量和配置模块
3
+ 该模块管理Jarvis系统的全局状态和配置。
4
+ 包含:
5
+ - 全局代理管理
6
+ - 带有自定义主题的控制台配置
7
+ - 环境初始化
8
8
  """
9
9
  from typing import Any, Set
10
10
  import colorama
11
11
  import os
12
12
  from rich.console import Console
13
13
  from rich.theme import Theme
14
- # Initialize colorama for cross-platform colored text
14
+ # 初始化colorama以支持跨平台的彩色文本
15
15
  colorama.init()
16
- # Disable tokenizers parallelism to avoid issues with multiprocessing
16
+ # 禁用tokenizers并行以避免多进程问题
17
17
  os.environ["TOKENIZERS_PARALLELISM"] = "false"
18
- # Global agent management
18
+ # 全局代理管理
19
19
  global_agents: Set[str] = set()
20
20
  current_agent_name: str = ""
21
- # Configure rich console with custom theme
21
+ # 使用自定义主题配置rich控制台
22
22
  custom_theme = Theme({
23
23
  "INFO": "yellow",
24
24
  "WARNING": "yellow",
@@ -36,13 +36,13 @@ custom_theme = Theme({
36
36
  console = Console(theme=custom_theme)
37
37
  def make_agent_name(agent_name: str) -> str:
38
38
  """
39
- Generate a unique agent name by appending a suffix if necessary.
39
+ 通过附加后缀生成唯一的代理名称(如果必要)。
40
40
 
41
- Args:
42
- agent_name: The base agent name
41
+ 参数:
42
+ agent_name: 基础代理名称
43
43
 
44
- Returns:
45
- str: Unique agent name
44
+ 返回:
45
+ str: 唯一的代理名称
46
46
  """
47
47
  if agent_name in global_agents:
48
48
  i = 1
@@ -52,31 +52,31 @@ def make_agent_name(agent_name: str) -> str:
52
52
  return agent_name
53
53
  def set_agent(agent_name: str, agent: Any) -> None:
54
54
  """
55
- Set the current agent and add it to the global agents set.
55
+ 设置当前代理并将其添加到全局代理集合中。
56
56
 
57
- Args:
58
- agent_name: The name of the agent
59
- agent: The agent object
57
+ 参数:
58
+ agent_name: 代理名称
59
+ agent: 代理对象
60
60
  """
61
61
  global_agents.add(agent_name)
62
62
  global current_agent_name
63
63
  current_agent_name = agent_name
64
64
  def get_agent_list() -> str:
65
65
  """
66
- Get a formatted string representing the current agent status.
66
+ 获取表示当前代理状态的格式化字符串。
67
67
 
68
- Returns:
69
- str: Formatted string with agent count and current agent name
68
+ 返回:
69
+ str: 包含代理数量和当前代理名称的格式化字符串
70
70
  """
71
71
  return "[" + str(len(global_agents)) + "]" + current_agent_name if global_agents else ""
72
72
  def delete_agent(agent_name: str) -> None:
73
73
  """
74
- Delete an agent from the global agents set.
74
+ 从全局代理集合中删除一个代理。
75
75
 
76
- Args:
77
- agent_name: The name of the agent to delete
76
+ 参数:
77
+ agent_name: 要删除的代理名称
78
78
  """
79
79
  if agent_name in global_agents:
80
80
  global_agents.remove(agent_name)
81
81
  global current_agent_name
82
- current_agent_name = ""
82
+ current_agent_name = ""
@@ -1,11 +1,11 @@
1
1
  """
2
- Input Handling Module
3
- This module provides utilities for handling user input in the Jarvis system.
4
- It includes:
5
- - Single line input with history support
6
- - Multi-line input with enhanced completion
7
- - File path completion with fuzzy matching
8
- - Custom key bindings for input control
2
+ 输入处理模块
3
+ 该模块提供了处理Jarvis系统中用户输入的实用工具。
4
+ 包含:
5
+ - 支持历史记录的单行输入
6
+ - 增强补全功能的多行输入
7
+ - 带有模糊匹配的文件路径补全
8
+ - 用于输入控制的自定义键绑定
9
9
  """
10
10
  from prompt_toolkit import PromptSession
11
11
  from prompt_toolkit.styles import Style as PromptStyle
@@ -18,13 +18,13 @@ from colorama import Fore, Style as ColoramaStyle
18
18
  from ..jarvis_utils.output import PrettyOutput, OutputType
19
19
  def get_single_line_input(tip: str) -> str:
20
20
  """
21
- Get single line input with history support.
21
+ 获取支持历史记录的单行输入。
22
22
 
23
- Args:
24
- tip: The prompt message to display
23
+ 参数:
24
+ tip: 要显示的提示信息
25
25
 
26
- Returns:
27
- str: The user's input
26
+ 返回:
27
+ str: 用户的输入
28
28
  """
29
29
  session = PromptSession(history=None)
30
30
  style = PromptStyle.from_dict({
@@ -33,49 +33,65 @@ def get_single_line_input(tip: str) -> str:
33
33
  return session.prompt(f"{tip}", style=style)
34
34
  class FileCompleter(Completer):
35
35
  """
36
- Custom completer for file paths with fuzzy matching.
36
+ 带有模糊匹配的文件路径自定义补全器。
37
37
 
38
- Attributes:
39
- path_completer: Base path completer
40
- max_suggestions: Maximum number of suggestions to show
41
- min_score: Minimum matching score for suggestions
38
+ 属性:
39
+ path_completer: 基础路径补全器
40
+ max_suggestions: 显示的最大建议数量
41
+ min_score: 建议的最小匹配分数
42
42
  """
43
43
  def __init__(self):
44
- """Initialize the file completer with default settings."""
44
+ """使用默认设置初始化文件补全器。"""
45
45
  self.path_completer = PathCompleter()
46
46
  self.max_suggestions = 10
47
47
  self.min_score = 10
48
48
  def get_completions(self, document: Document, complete_event) -> Completion: # type: ignore
49
49
  """
50
- Generate completions for file paths with fuzzy matching.
50
+ 生成带有模糊匹配的文件路径补全建议。
51
51
 
52
- Args:
53
- document: The current document being edited
54
- complete_event: The completion event
52
+ 参数:
53
+ document: 当前正在编辑的文档
54
+ complete_event: 补全事件
55
55
 
56
- Yields:
57
- Completion: Suggested completions
56
+ 生成:
57
+ Completion: 建议的补全项
58
58
  """
59
59
  text = document.text_before_cursor
60
60
  cursor_pos = document.cursor_position
61
- # Find all @ positions in text
61
+ # 查找文本中的所有@位置
62
62
  at_positions = [i for i, char in enumerate(text) if char == '@']
63
63
  if not at_positions:
64
64
  return
65
- # Get the last @ position
65
+ # 获取最后一个@位置
66
66
  current_at_pos = at_positions[-1]
67
- # If cursor is not after the last @, don't complete
67
+ # 如果光标不在最后一个@之后,则不补全
68
68
  if cursor_pos <= current_at_pos:
69
69
  return
70
- # Check if there's a space after @
70
+ # 检查@之后是否有空格
71
71
  text_after_at = text[current_at_pos + 1:cursor_pos]
72
72
  if ' ' in text_after_at:
73
73
  return
74
- # Get the text after the current @
74
+ # 添加默认建议
75
+ if not text_after_at.strip():
76
+ # 默认建议列表
77
+ default_suggestions = [
78
+ ('<CodeBase>', '查询代码库'),
79
+ ('<Web>', '网页搜索'),
80
+ ('<RAG>', '知识库检索')
81
+ ]
82
+ for name, desc in default_suggestions:
83
+ yield Completion(
84
+ text=f"'{name}'",
85
+ start_position=-1,
86
+ display=name,
87
+ display_meta=desc
88
+ ) # type: ignore
89
+ return
90
+ # 获取当前@之后的文本
75
91
  file_path = text_after_at.strip()
76
- # Calculate replacement length
92
+ # 计算替换长度
77
93
  replace_length = len(text_after_at) + 1
78
- # Get all possible files using git ls-files
94
+ # 使用git ls-files获取所有可能的文件
79
95
  all_files = []
80
96
  try:
81
97
  import subprocess
@@ -87,7 +103,7 @@ class FileCompleter(Completer):
87
103
  all_files = [line.strip() for line in result.stdout.splitlines() if line.strip()]
88
104
  except Exception:
89
105
  pass
90
- # Generate completions
106
+ # 生成补全建议
91
107
  if not file_path:
92
108
  scored_files = [(path, 100) for path in all_files[:self.max_suggestions]]
93
109
  else:
@@ -95,7 +111,7 @@ class FileCompleter(Completer):
95
111
  scored_files = [(m[0], m[1]) for m in scored_files_data]
96
112
  scored_files.sort(key=lambda x: x[1], reverse=True)
97
113
  scored_files = scored_files[:self.max_suggestions]
98
- # Yield completions
114
+ # 生成补全项
99
115
  for path, score in scored_files:
100
116
  if not file_path or score > self.min_score:
101
117
  display_text = path
@@ -109,31 +125,31 @@ class FileCompleter(Completer):
109
125
  ) # type: ignore
110
126
  def get_multiline_input(tip: str) -> str:
111
127
  """
112
- Get multi-line input with enhanced completion and confirmation.
128
+ 获取带有增强补全和确认功能的多行输入。
113
129
 
114
- Args:
115
- tip: The prompt message to display
130
+ 参数:
131
+ tip: 要显示的提示信息
116
132
 
117
- Returns:
118
- str: The user's input, or empty string if canceled
133
+ 返回:
134
+ str: 用户的输入,如果取消则返回空字符串
119
135
  """
120
- # Display input instructions
136
+ # 显示输入说明
121
137
  PrettyOutput.section("用户输入 - 使用 @ 触发文件补全,Tab 选择补全项,Ctrl+J 提交,按 Ctrl+C 取消输入", OutputType.USER)
122
138
  print(f"{Fore.GREEN}{tip}{ColoramaStyle.RESET_ALL}")
123
- # Configure key bindings
139
+ # 配置键绑定
124
140
  bindings = KeyBindings()
125
141
  @bindings.add('enter')
126
142
  def _(event):
127
- """Handle enter key for completion or new line."""
143
+ """处理回车键以进行补全或换行。"""
128
144
  if event.current_buffer.complete_state:
129
145
  event.current_buffer.apply_completion(event.current_buffer.complete_state.current_completion)
130
146
  else:
131
147
  event.current_buffer.insert_text('\n')
132
148
  @bindings.add('c-j')
133
149
  def _(event):
134
- """Handle Ctrl+J for submission."""
150
+ """处理Ctrl+J以提交输入。"""
135
151
  event.current_buffer.validate_and_handle()
136
- # Configure prompt session
152
+ # 配置提示会话
137
153
  style = PromptStyle.from_dict({
138
154
  'prompt': 'ansicyan',
139
155
  })
@@ -150,7 +166,7 @@ def get_multiline_input(tip: str) -> str:
150
166
  prompt = FormattedText([
151
167
  ('class:prompt', '>>> ')
152
168
  ])
153
- # Get input
169
+ # 获取输入
154
170
  text = session.prompt(
155
171
  prompt,
156
172
  style=style,
@@ -158,4 +174,4 @@ def get_multiline_input(tip: str) -> str:
158
174
  return text
159
175
  except KeyboardInterrupt:
160
176
  PrettyOutput.print("输入已取消", OutputType.INFO)
161
- return ""
177
+ return ""
@@ -1,11 +1,11 @@
1
1
  """
2
- Methodology Management Module
3
- This module provides utilities for loading and searching methodologies.
4
- It includes functions for:
5
- - Creating methodology embeddings
6
- - Loading and processing methodology data
7
- - Building and searching methodology index
8
- - Generating methodology prompts
2
+ 方法论管理模块
3
+ 该模块提供了加载和搜索方法论的实用工具。
4
+ 包含以下功能:
5
+ - 创建方法论嵌入向量
6
+ - 加载和处理方法论数据
7
+ - 构建和搜索方法论索引
8
+ - 生成方法论提示
9
9
  """
10
10
  import os
11
11
  import yaml
@@ -17,17 +17,17 @@ from jarvis.jarvis_utils.embedding import load_embedding_model
17
17
  from jarvis.jarvis_utils.config import dont_use_local_model
18
18
  def _create_methodology_embedding(embedding_model: Any, methodology_text: str) -> np.ndarray:
19
19
  """
20
- Create embedding vector for methodology text.
20
+ 为方法论文本创建嵌入向量。
21
21
 
22
- Args:
23
- embedding_model: The embedding model to use
24
- methodology_text: The text to create embedding for
22
+ 参数:
23
+ embedding_model: 使用的嵌入模型
24
+ methodology_text: 要创建嵌入的文本
25
25
 
26
- Returns:
27
- np.ndarray: The embedding vector
26
+ 返回:
27
+ np.ndarray: 嵌入向量
28
28
  """
29
29
  try:
30
- # Truncate long text
30
+ # 截断长文本
31
31
  max_length = 512
32
32
  text = ' '.join(methodology_text.split()[:max_length])
33
33
 
@@ -36,7 +36,7 @@ def _create_methodology_embedding(embedding_model: Any, methodology_text: str) -
36
36
  convert_to_tensor=True,
37
37
  normalize_embeddings=True)
38
38
  vector = np.array(embedding.cpu().numpy(), dtype=np.float32)
39
- return vector[0] # Return first vector, because we only encoded one text
39
+ return vector[0] # 返回第一个向量,因为我们只编码了一个文本
40
40
  except Exception as e:
41
41
  PrettyOutput.print(f"创建方法论嵌入向量失败: {str(e)}", OutputType.ERROR)
42
42
  return np.zeros(1536, dtype=np.float32)
@@ -44,10 +44,10 @@ def make_methodology_prompt(data: Dict[str, str]) -> str:
44
44
  """
45
45
  从方法论数据生成格式化提示
46
46
 
47
- Args:
47
+ 参数:
48
48
  data: 方法论数据字典
49
49
 
50
- Returns:
50
+ 返回:
51
51
  str: 格式化后的提示字符串
52
52
  """
53
53
  ret = """这是处理以往问题的标准方法论,如果当前任务类似,可以参考使用,如果不相关,请忽略:\n"""
@@ -57,13 +57,13 @@ def make_methodology_prompt(data: Dict[str, str]) -> str:
57
57
 
58
58
  def load_methodology(user_input: str) -> str:
59
59
  """
60
- Load methodology and build vector index for similarity search.
60
+ 加载方法论并构建向量索引以进行相似性搜索。
61
61
 
62
- Args:
63
- user_input: The input text to search methodologies for
62
+ 参数:
63
+ user_input: 要搜索方法论的输入文本
64
64
 
65
- Returns:
66
- str: Relevant methodology prompt or empty string if no methodology found
65
+ 返回:
66
+ str: 相关的方法论提示,如果未找到方法论则返回空字符串
67
67
  """
68
68
  from yaspin import yaspin
69
69
  user_jarvis_methodology = os.path.expanduser("~/.jarvis/methodology")
@@ -1,11 +1,11 @@
1
1
  """
2
- Output Formatting Module
3
- This module provides rich text formatting and display utilities for the Jarvis system.
4
- It includes:
5
- - OutputType enum for categorizing different types of output
6
- - PrettyOutput class for formatting and displaying styled output
7
- - Syntax highlighting support for various programming languages
8
- - Panel-based display for structured output
2
+ 输出格式化模块
3
+ 该模块为Jarvis系统提供了丰富的文本格式化和显示工具。
4
+ 包含:
5
+ - 用于分类不同输出类型的OutputType枚举
6
+ - 用于格式化和显示样式化输出的PrettyOutput
7
+ - 多种编程语言的语法高亮支持
8
+ - 结构化输出的面板显示
9
9
  """
10
10
  from enum import Enum
11
11
  from datetime import datetime
@@ -20,21 +20,21 @@ from pygments.util import ClassNotFound
20
20
  from .globals import console, get_agent_list
21
21
  class OutputType(Enum):
22
22
  """
23
- Enumeration of output types for categorizing and styling different types of messages.
23
+ 输出类型枚举,用于分类和样式化不同类型的消息。
24
24
 
25
- Attributes:
26
- SYSTEM: AI assistant message
27
- CODE: Code related output
28
- RESULT: Tool execution result
29
- ERROR: Error information
30
- INFO: System prompt
31
- PLANNING: Task planning
32
- PROGRESS: Execution progress
33
- SUCCESS: Success information
34
- WARNING: Warning information
35
- DEBUG: Debug information
36
- USER: User input
37
- TOOL: Tool call
25
+ 属性:
26
+ SYSTEM: AI助手消息
27
+ CODE: 代码相关输出
28
+ RESULT: 工具执行结果
29
+ ERROR: 错误信息
30
+ INFO: 系统提示
31
+ PLANNING: 任务规划
32
+ PROGRESS: 执行进度
33
+ SUCCESS: 成功信息
34
+ WARNING: 警告信息
35
+ DEBUG: 调试信息
36
+ USER: 用户输入
37
+ TOOL: 工具调用
38
38
  """
39
39
  SYSTEM = "SYSTEM"
40
40
  CODE = "CODE"
@@ -50,15 +50,15 @@ class OutputType(Enum):
50
50
  TOOL = "TOOL"
51
51
  class PrettyOutput:
52
52
  """
53
- Class for formatting and displaying rich text output using the rich library.
53
+ 使用rich库格式化和显示富文本输出的类。
54
54
 
55
- Provides methods for:
56
- - Formatting different types of output with appropriate styling
57
- - Syntax highlighting for code blocks
58
- - Panel-based display for structured content
59
- - Stream output for progressive display
55
+ 提供以下方法:
56
+ - 使用适当的样式格式化不同类型的输出
57
+ - 代码块的语法高亮
58
+ - 结构化内容的面板显示
59
+ - 渐进显示的流式输出
60
60
  """
61
- # Icons for different output types
61
+ # 不同输出类型的图标
62
62
  _ICONS = {
63
63
  OutputType.SYSTEM: "🤖",
64
64
  OutputType.CODE: "📝",
@@ -73,7 +73,7 @@ class PrettyOutput:
73
73
  OutputType.USER: "👤",
74
74
  OutputType.TOOL: "🔧",
75
75
  }
76
- # Language mapping for syntax highlighting
76
+ # 语法高亮的语言映射
77
77
  _lang_map = {
78
78
  'Python': 'python',
79
79
  'JavaScript': 'javascript',
@@ -109,14 +109,14 @@ class PrettyOutput:
109
109
  @staticmethod
110
110
  def _detect_language(text: str, default_lang: str = 'markdown') -> str:
111
111
  """
112
- Detect the programming language of the given text.
112
+ 检测给定文本的编程语言。
113
113
 
114
- Args:
115
- text: The text to analyze
116
- default_lang: Default language if detection fails
114
+ 参数:
115
+ text: 要分析的文本
116
+ default_lang: 如果检测失败,默认返回的语言
117
117
 
118
- Returns:
119
- str: Detected language name
118
+ 返回:
119
+ str: 检测到的语言名称
120
120
  """
121
121
  try:
122
122
  lexer = guess_lexer(text)
@@ -127,14 +127,14 @@ class PrettyOutput:
127
127
  @staticmethod
128
128
  def _format(output_type: OutputType, timestamp: bool = True) -> Text:
129
129
  """
130
- Format the output header with timestamp and icon.
130
+ 使用时间戳和图标格式化输出头。
131
131
 
132
- Args:
133
- output_type: Type of output
134
- timestamp: Whether to include timestamp
132
+ 参数:
133
+ output_type: 输出类型
134
+ timestamp: 是否包含时间戳
135
135
 
136
- Returns:
137
- Text: Formatted rich Text object
136
+ 返回:
137
+ Text: 格式化后的rich Text对象
138
138
  """
139
139
  formatted = Text()
140
140
  if timestamp:
@@ -148,14 +148,14 @@ class PrettyOutput:
148
148
  @staticmethod
149
149
  def print(text: str, output_type: OutputType, timestamp: bool = True, lang: Optional[str] = None, traceback: bool = False):
150
150
  """
151
- Print formatted output with styling and syntax highlighting.
151
+ 使用样式和语法高亮打印格式化输出。
152
152
 
153
- Args:
154
- text: The text content to print
155
- output_type: The type of output (affects styling)
156
- timestamp: Whether to show timestamp
157
- lang: Language for syntax highlighting
158
- traceback: Whether to show traceback for errors
153
+ 参数:
154
+ text: 要打印的文本内容
155
+ output_type: 输出类型(影响样式)
156
+ timestamp: 是否显示时间戳
157
+ lang: 语法高亮的语言
158
+ traceback: 是否显示错误的回溯信息
159
159
  """
160
160
  styles = {
161
161
  OutputType.SYSTEM: RichStyle(color="bright_cyan", bgcolor="#1a1a1a", frame=True, meta={"icon": "🤖"}),
@@ -182,7 +182,7 @@ class PrettyOutput:
182
182
  title_align="left",
183
183
  padding=(0, 0),
184
184
  highlight=True,
185
- box=HEAVY,
185
+ # box=HEAVY,
186
186
  )
187
187
  console.print()
188
188
  console.print(panel)
@@ -191,11 +191,11 @@ class PrettyOutput:
191
191
  @staticmethod
192
192
  def section(title: str, output_type: OutputType = OutputType.INFO):
193
193
  """
194
- Print a section title in a styled panel.
194
+ 在样式化面板中打印章节标题。
195
195
 
196
- Args:
197
- title: The section title text
198
- output_type: The type of output (affects styling)
196
+ 参数:
197
+ title: 章节标题文本
198
+ output_type: 输出类型(影响样式)
199
199
  """
200
200
  panel = Panel(
201
201
  Text(title, style=output_type.value, justify="center"),
@@ -207,17 +207,17 @@ class PrettyOutput:
207
207
  @staticmethod
208
208
  def print_stream(text: str):
209
209
  """
210
- Print stream output without line break.
210
+ 打印流式输出,不带换行符。
211
211
 
212
- Args:
213
- text: The text to print
212
+ 参数:
213
+ text: 要打印的文本
214
214
  """
215
- style = PrettyOutput._get_style(OutputType.SYSTEM)
215
+ style = RichStyle(color="bright_cyan", italic=True, frame=True, meta={"icon": "🤖"})
216
216
  console.print(text, style=style, end="")
217
217
  @staticmethod
218
218
  def print_stream_end():
219
219
  """
220
- End stream output with line break.
220
+ 结束流式输出,带换行符。
221
221
  """
222
222
  end_style = PrettyOutput._get_style(OutputType.SUCCESS)
223
223
  console.print("\n", style=end_style)
@@ -225,12 +225,12 @@ class PrettyOutput:
225
225
  @staticmethod
226
226
  def _get_style(output_type: OutputType) -> RichStyle:
227
227
  """
228
- Get pre-defined RichStyle for output type.
228
+ 获取预定义的RichStyle用于输出类型。
229
229
 
230
- Args:
231
- output_type: The output type to get style for
230
+ 参数:
231
+ output_type: 要获取样式的输出类型
232
232
 
233
- Returns:
234
- RichStyle: The corresponding style
233
+ 返回:
234
+ RichStyle: 对应的样式
235
235
  """
236
- return console.get_style(output_type.value)
236
+ return console.get_style(output_type.value)
@@ -130,7 +130,7 @@ def init_gpu_config() -> Dict:
130
130
 
131
131
 
132
132
  def is_long_context(files: list) -> bool:
133
- """Check if the file list belongs to a long context (total characters exceed 80% of the maximum context length)"""
133
+ """检查文件列表是否属于长上下文(总字符数超过最大上下文长度的80%)"""
134
134
  max_token_count = get_max_token_count()
135
135
  threshold = max_token_count * 0.8
136
136
  total_tokens = 0
@@ -147,4 +147,4 @@ def is_long_context(files: list) -> bool:
147
147
  PrettyOutput.print(f"读取文件 {file_path} 失败: {e}", OutputType.WARNING)
148
148
  continue
149
149
 
150
- return total_tokens > threshold
150
+ return total_tokens > threshold
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.128
3
+ Version: 0.1.130
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