jarvis-ai-assistant 0.1.97__py3-none-any.whl → 0.1.98__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 +1 -1
- jarvis/jarvis_coder/git_utils.py +18 -18
- jarvis/jarvis_coder/main.py +150 -150
- jarvis/jarvis_coder/patch_handler.py +38 -38
- jarvis/jarvis_coder/plan_generator.py +21 -21
- jarvis/jarvis_platform/main.py +38 -38
- jarvis/jarvis_rag/main.py +181 -181
- jarvis/jarvis_smart_shell/main.py +19 -19
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/RECORD +14 -14
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/top_level.txt +0 -0
|
@@ -11,33 +11,33 @@ from jarvis.models.registry import PlatformRegistry
|
|
|
11
11
|
from jarvis.utils import PrettyOutput, OutputType, load_env_from_file
|
|
12
12
|
|
|
13
13
|
def execute_command(command: str) -> None:
|
|
14
|
-
"""
|
|
14
|
+
"""Show command and allow user to edit, then execute, Ctrl+C to cancel"""
|
|
15
15
|
try:
|
|
16
|
-
print("\
|
|
17
|
-
#
|
|
16
|
+
print("\nGenerated command (can be edited, press Enter to execute, Ctrl+C to cancel):")
|
|
17
|
+
# Pre-fill input line
|
|
18
18
|
readline.set_startup_hook(lambda: readline.insert_text(command))
|
|
19
19
|
try:
|
|
20
20
|
edited_command = input("> ")
|
|
21
|
-
if edited_command.strip(): #
|
|
21
|
+
if edited_command.strip(): # Ensure command is not empty
|
|
22
22
|
os.system(edited_command)
|
|
23
23
|
except KeyboardInterrupt:
|
|
24
|
-
print("\
|
|
24
|
+
print("\nExecution cancelled")
|
|
25
25
|
finally:
|
|
26
|
-
readline.set_startup_hook() #
|
|
26
|
+
readline.set_startup_hook() # Clear pre-filled
|
|
27
27
|
except Exception as e:
|
|
28
|
-
PrettyOutput.print(f"
|
|
28
|
+
PrettyOutput.print(f"Failed to execute command: {str(e)}", OutputType.ERROR)
|
|
29
29
|
|
|
30
30
|
def process_request(request: str) -> Optional[str]:
|
|
31
|
-
"""
|
|
31
|
+
"""Process user request and return corresponding shell command
|
|
32
32
|
|
|
33
33
|
Args:
|
|
34
|
-
request:
|
|
34
|
+
request: User's natural language request
|
|
35
35
|
|
|
36
36
|
Returns:
|
|
37
|
-
Optional[str]:
|
|
37
|
+
Optional[str]: Corresponding shell command, return None if processing fails
|
|
38
38
|
"""
|
|
39
39
|
try:
|
|
40
|
-
#
|
|
40
|
+
# Get language model instance
|
|
41
41
|
PlatformRegistry.suppress_output = True
|
|
42
42
|
model = PlatformRegistry.get_global_platform_registry().get_normal_platform()
|
|
43
43
|
model.set_suppress_output(True)
|
|
@@ -45,7 +45,7 @@ def process_request(request: str) -> Optional[str]:
|
|
|
45
45
|
shell = os.environ.get("SHELL") or "bash"
|
|
46
46
|
current_path = os.getcwd()
|
|
47
47
|
|
|
48
|
-
#
|
|
48
|
+
# Set system prompt
|
|
49
49
|
system_message = f"""You are a shell command generation assistant.
|
|
50
50
|
|
|
51
51
|
Your only task is to convert user's natural language requirements into corresponding shell commands.
|
|
@@ -85,26 +85,26 @@ Remember: Only return the command itself, without any additional content.
|
|
|
85
85
|
return None
|
|
86
86
|
|
|
87
87
|
except Exception as e:
|
|
88
|
-
PrettyOutput.print(f"
|
|
88
|
+
PrettyOutput.print(f"Failed to process request: {str(e)}", OutputType.ERROR)
|
|
89
89
|
return None
|
|
90
90
|
|
|
91
91
|
def main():
|
|
92
92
|
# 创建参数解析器
|
|
93
93
|
load_env_from_file()
|
|
94
94
|
parser = argparse.ArgumentParser(
|
|
95
|
-
description="
|
|
95
|
+
description="Convert natural language requirements to shell commands",
|
|
96
96
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
97
97
|
epilog="""
|
|
98
|
-
|
|
99
|
-
%(prog)s "
|
|
100
|
-
%(prog)s "
|
|
101
|
-
%(prog)s "
|
|
98
|
+
Example:
|
|
99
|
+
%(prog)s "Find all Python files in the current directory"
|
|
100
|
+
%(prog)s "Compress all jpg images"
|
|
101
|
+
%(prog)s "Find documents modified in the last week"
|
|
102
102
|
""")
|
|
103
103
|
|
|
104
104
|
# 添加参数
|
|
105
105
|
parser.add_argument(
|
|
106
106
|
"request",
|
|
107
|
-
help="
|
|
107
|
+
help="Describe the operation you want to perform in natural language"
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
# 解析参数
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=LaazWaS94sRO9a8aOdOMwKl05JkbI63DYYlhGFXw32M,50
|
|
2
2
|
jarvis/agent.py,sha256=9dfXBYO2QPYpiIXJixgoc1-CKHBDQcBlhskWrb0ZNYc,19636
|
|
3
3
|
jarvis/main.py,sha256=mV_rW268R2CWnwDLUqmCqVOzEZBodwJoTzPiz979QF8,5919
|
|
4
4
|
jarvis/utils.py,sha256=nqmOuQtmoIsc67iQNuWADwbXf2D3cbGjXan5VXLaTYk,11373
|
|
5
5
|
jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
jarvis/jarvis_codebase/main.py,sha256=8A4VwK_MjAknT6ANj5Ptgf3wDD6e8rFOQVcU4gcVvH8,31183
|
|
7
7
|
jarvis/jarvis_coder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
jarvis/jarvis_coder/git_utils.py,sha256=
|
|
9
|
-
jarvis/jarvis_coder/main.py,sha256=
|
|
10
|
-
jarvis/jarvis_coder/patch_handler.py,sha256=
|
|
11
|
-
jarvis/jarvis_coder/plan_generator.py,sha256=
|
|
8
|
+
jarvis/jarvis_coder/git_utils.py,sha256=91Kv7Q4SFNXj-SJ5L-5Bv5UQVXEPnR7LCLXPNygGViA,2334
|
|
9
|
+
jarvis/jarvis_coder/main.py,sha256=Rjjq8pBhKaSpsjPJ-qbehYq_7wLjmeeZUjlXGgamuhI,25853
|
|
10
|
+
jarvis/jarvis_coder/patch_handler.py,sha256=YOTG-OZa-J6Zhp7IzSTCLQn90vyN3eSbOQyqzT7LZiE,9768
|
|
11
|
+
jarvis/jarvis_coder/plan_generator.py,sha256=nAaBFwPPI5Lu89hsZRYad0m_hTELnRQZ2plSx6VJU3Q,4585
|
|
12
12
|
jarvis/jarvis_platform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
jarvis/jarvis_platform/main.py,sha256=
|
|
13
|
+
jarvis/jarvis_platform/main.py,sha256=Hb40MmN4We9oY8BHzLyrNTm-p7Mg50s2nqLaLxflC48,4981
|
|
14
14
|
jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
jarvis/jarvis_rag/main.py,sha256=
|
|
15
|
+
jarvis/jarvis_rag/main.py,sha256=z6D-2nNVptp7YGHhU4O8gSfFsEXhNkPvj6ZMJztQuuU,33490
|
|
16
16
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
jarvis/jarvis_smart_shell/main.py,sha256=
|
|
17
|
+
jarvis/jarvis_smart_shell/main.py,sha256=MOTSlE09YqwV4smWjHTGLKPf--hFMWfGrgD1LMb1FGU,3988
|
|
18
18
|
jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
|
|
19
19
|
jarvis/models/ai8.py,sha256=ZRNO3aRjmICRjCXl-_F9pTNQTY4j1tUd-WJoJpb9n4Y,11958
|
|
20
20
|
jarvis/models/base.py,sha256=5QQAghMmVsg7jXvQN9ZzVoqCmMR0jb9bKgAVR3eOjQ8,2005
|
|
@@ -39,9 +39,9 @@ jarvis/tools/shell.py,sha256=6XIDzdTf67PDIObUZqLtHvhnlOLSyuV_GlfFwQJsSaU,2580
|
|
|
39
39
|
jarvis/tools/sub_agent.py,sha256=7YPY3qUocH7RjE3MDKFGlXKlAMIQv3-ufPRzlNXwo7w,2676
|
|
40
40
|
jarvis/tools/thinker.py,sha256=VFq0z9geAtGsRCbd8S73Rk7afAuGm3KQp6t5nayUJVg,4800
|
|
41
41
|
jarvis/tools/webpage.py,sha256=_ts9ioSFR2wcMwjId_aV-jqSWpbiydU_beJQyn_aAv4,2405
|
|
42
|
-
jarvis_ai_assistant-0.1.
|
|
43
|
-
jarvis_ai_assistant-0.1.
|
|
44
|
-
jarvis_ai_assistant-0.1.
|
|
45
|
-
jarvis_ai_assistant-0.1.
|
|
46
|
-
jarvis_ai_assistant-0.1.
|
|
47
|
-
jarvis_ai_assistant-0.1.
|
|
42
|
+
jarvis_ai_assistant-0.1.98.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
43
|
+
jarvis_ai_assistant-0.1.98.dist-info/METADATA,sha256=-s5OHAXkUGAVfb8oL5VJLIC2NUQRk2Vn0WoSaHVaxX0,12766
|
|
44
|
+
jarvis_ai_assistant-0.1.98.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
45
|
+
jarvis_ai_assistant-0.1.98.dist-info/entry_points.txt,sha256=1D14s9v6rwpNzVD0muwe0tCKffJDEvLRBlEShbSFSbQ,331
|
|
46
|
+
jarvis_ai_assistant-0.1.98.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
47
|
+
jarvis_ai_assistant-0.1.98.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|