yaicli 0.0.2__py3-none-any.whl → 0.0.4__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.
- {yaicli-0.0.2.dist-info → yaicli-0.0.4.dist-info}/METADATA +1 -1
- yaicli-0.0.4.dist-info/RECORD +6 -0
- yaicli.py +19 -23
- yaicli-0.0.2.dist-info/RECORD +0 -6
- {yaicli-0.0.2.dist-info → yaicli-0.0.4.dist-info}/WHEEL +0 -0
- {yaicli-0.0.2.dist-info → yaicli-0.0.4.dist-info}/entry_points.txt +0 -0
- {yaicli-0.0.2.dist-info → yaicli-0.0.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
yaicli.py,sha256=CY5TnPQAypGJ1FQLiryGBV4UFc8E1ZQyaNmT7ghw7NU,16741
|
2
|
+
yaicli-0.0.4.dist-info/METADATA,sha256=fY81CYJR2jcWmwElOe3rSk-wM4Lk27SZhTPdK0eHw4E,379
|
3
|
+
yaicli-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
4
|
+
yaicli-0.0.4.dist-info/entry_points.txt,sha256=gdduQwAuu_LeDqnDU81Fv3NPmD2tRQ1FffvolIP3S1Q,34
|
5
|
+
yaicli-0.0.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
6
|
+
yaicli-0.0.4.dist-info/RECORD,,
|
yaicli.py
CHANGED
@@ -79,9 +79,7 @@ STREAM=true"""
|
|
79
79
|
@self.bindings.add(Keys.ControlI) # Bind Ctrl+I to switch modes
|
80
80
|
def _(event: KeyPressEvent):
|
81
81
|
self.current_mode = (
|
82
|
-
ModeEnum.CHAT.value
|
83
|
-
if self.current_mode == ModeEnum.EXECUTE.value
|
84
|
-
else ModeEnum.EXECUTE.value
|
82
|
+
ModeEnum.CHAT.value if self.current_mode == ModeEnum.EXECUTE.value else ModeEnum.EXECUTE.value
|
85
83
|
)
|
86
84
|
|
87
85
|
def detect_os(self):
|
@@ -126,9 +124,8 @@ Rules:
|
|
126
124
|
_os = self.detect_os()
|
127
125
|
_shell = self.detect_shell()
|
128
126
|
return (
|
129
|
-
"You are a system and
|
130
|
-
f"
|
131
|
-
"Assist with system management, script writing, and coding tasks. "
|
127
|
+
"You are yaili, a system management and programing assistant, "
|
128
|
+
f"You are managing {_os} operating system with {_shell} shell. "
|
132
129
|
"Your responses should be concise and use Markdown format, "
|
133
130
|
"unless the user explicitly requests more details."
|
134
131
|
)
|
@@ -235,6 +232,8 @@ Rules:
|
|
235
232
|
response = self._call_api(url, headers, data)
|
236
233
|
except requests.exceptions.RequestException as e:
|
237
234
|
self.console.print(f"[red]Error calling API: {e}[/red]")
|
235
|
+
if self.verbose and e.response:
|
236
|
+
self.console.print(f"{e.response.text}")
|
238
237
|
raise typer.Exit(code=1) from None
|
239
238
|
if not response:
|
240
239
|
raise typer.Exit(code=1)
|
@@ -271,9 +270,7 @@ Rules:
|
|
271
270
|
self.console.print(f"\n[bold green]Executing command: [/bold green] {command}\n")
|
272
271
|
result = subprocess.run(command, shell=True)
|
273
272
|
if result.returncode != 0:
|
274
|
-
self.console.print(
|
275
|
-
f"\n[bold red]Command failed with return code: {result.returncode}[/bold red]"
|
276
|
-
)
|
273
|
+
self.console.print(f"\n[bold red]Command failed with return code: {result.returncode}[/bold red]")
|
277
274
|
|
278
275
|
def get_prompt_tokens(self):
|
279
276
|
"""Get prompt tokens based on current mode"""
|
@@ -382,9 +379,7 @@ Rules:
|
|
382
379
|
# Load configuration
|
383
380
|
self.config = self.load_config()
|
384
381
|
if not self.config.get("API_KEY", None):
|
385
|
-
self.console.print(
|
386
|
-
"[red]API key not found. Please set it in the configuration file.[/red]"
|
387
|
-
)
|
382
|
+
self.console.print("[red]API key not found. Please set it in the configuration file.[/red]")
|
388
383
|
return
|
389
384
|
|
390
385
|
# Set initial mode
|
@@ -417,10 +412,10 @@ CONTEXT_SETTINGS = {
|
|
417
412
|
}
|
418
413
|
|
419
414
|
app = typer.Typer(
|
420
|
-
name="
|
415
|
+
name="yaicli",
|
421
416
|
context_settings=CONTEXT_SETTINGS,
|
422
417
|
pretty_exceptions_enable=False,
|
423
|
-
short_help="
|
418
|
+
short_help="yaicli. Your AI interface in cli.",
|
424
419
|
no_args_is_help=True,
|
425
420
|
invoke_without_command=True,
|
426
421
|
)
|
@@ -428,17 +423,18 @@ app = typer.Typer(
|
|
428
423
|
|
429
424
|
@app.command()
|
430
425
|
def main(
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
] = False,
|
426
|
+
ctx: typer.Context,
|
427
|
+
prompt: Annotated[str, typer.Argument(show_default=False, help="The prompt send to the LLM")] = "",
|
428
|
+
verbose: Annotated[bool, typer.Option("--verbose", "-V", help="Show verbose information")] = False,
|
435
429
|
chat: Annotated[bool, typer.Option("--chat", "-c", help="Start in chat mode")] = False,
|
436
|
-
shell: Annotated[
|
437
|
-
bool, typer.Option("--shell", "-s", help="Generate and execute shell command")
|
438
|
-
] = False,
|
430
|
+
shell: Annotated[bool, typer.Option("--shell", "-s", help="Generate and execute shell command")] = False,
|
439
431
|
):
|
440
|
-
"""
|
441
|
-
|
432
|
+
"""yaicli. Your AI interface in cli."""
|
433
|
+
if not prompt and not chat:
|
434
|
+
typer.echo(ctx.get_help())
|
435
|
+
raise typer.Exit()
|
436
|
+
|
437
|
+
cli = ShellAI(verbose=verbose)
|
442
438
|
cli.run(chat=chat, shell=shell, prompt=prompt)
|
443
439
|
|
444
440
|
|
yaicli-0.0.2.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
yaicli.py,sha256=4c5UFeIUFI7lQERM31drdaj-bR6Q1DP3WBhm5qnu6b4,16620
|
2
|
-
yaicli-0.0.2.dist-info/METADATA,sha256=N-j9mcia0VG5XmxoXfrLz5ziXWKE8lqbVgSMfv-qnCQ,379
|
3
|
-
yaicli-0.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
4
|
-
yaicli-0.0.2.dist-info/entry_points.txt,sha256=gdduQwAuu_LeDqnDU81Fv3NPmD2tRQ1FffvolIP3S1Q,34
|
5
|
-
yaicli-0.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
6
|
-
yaicli-0.0.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|