yaicli 0.5.4__py3-none-any.whl → 0.5.6__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.
- pyproject.toml +13 -1
- yaicli/cli.py +23 -14
- yaicli/printer.py +1 -7
- {yaicli-0.5.4.dist-info → yaicli-0.5.6.dist-info}/METADATA +46 -45
- {yaicli-0.5.4.dist-info → yaicli-0.5.6.dist-info}/RECORD +8 -8
- {yaicli-0.5.4.dist-info → yaicli-0.5.6.dist-info}/WHEEL +0 -0
- {yaicli-0.5.4.dist-info → yaicli-0.5.6.dist-info}/entry_points.txt +0 -0
- {yaicli-0.5.4.dist-info → yaicli-0.5.6.dist-info}/licenses/LICENSE +0 -0
pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "yaicli"
|
3
|
-
version = "0.5.
|
3
|
+
version = "0.5.6"
|
4
4
|
description = "A simple CLI tool to interact with LLM"
|
5
5
|
authors = [{ name = "belingud", email = "im.victor@qq.com" }]
|
6
6
|
readme = "README.md"
|
@@ -51,6 +51,18 @@ Documentation = "https://github.com/belingud/yaicli"
|
|
51
51
|
ai = "yaicli.entry:app"
|
52
52
|
yaicli = "yaicli.entry:app"
|
53
53
|
|
54
|
+
[tool.pytest.ini_options]
|
55
|
+
testpaths = ["tests"]
|
56
|
+
python_files = ["test_*.py"]
|
57
|
+
python_functions = ["test_*"]
|
58
|
+
filterwarnings = [
|
59
|
+
"ignore::DeprecationWarning",
|
60
|
+
"ignore::PendingDeprecationWarning",
|
61
|
+
"ignore::UserWarning",
|
62
|
+
"ignore::pydantic.PydanticDeprecatedSince20",
|
63
|
+
"ignore:.*There is no current event loop.*:DeprecationWarning"
|
64
|
+
]
|
65
|
+
|
54
66
|
[tool.uv]
|
55
67
|
resolution = "highest"
|
56
68
|
|
yaicli/cli.py
CHANGED
@@ -242,17 +242,21 @@ class CLI:
|
|
242
242
|
# ------------------- Special commands -------------------
|
243
243
|
def _handle_special_commands(self, user_input: str) -> Union[bool, str]:
|
244
244
|
"""Handle special command return: True-continue loop, False-exit loop, str-non-special command"""
|
245
|
-
|
246
|
-
if
|
245
|
+
lower_input = user_input.lower().strip()
|
246
|
+
if lower_input in CMD_HELP:
|
247
|
+
# case-insensitive
|
247
248
|
self.print_help()
|
248
249
|
return True
|
249
|
-
if
|
250
|
+
if lower_input == CMD_EXIT:
|
251
|
+
# case-insensitive
|
250
252
|
return False
|
251
|
-
if
|
253
|
+
if lower_input == CMD_CLEAR and self.current_mode == CHAT_MODE:
|
254
|
+
# case-insensitive
|
252
255
|
self.chat.history.clear()
|
253
256
|
self.console.print("Chat history cleared", style="bold yellow")
|
254
257
|
return True
|
255
|
-
if
|
258
|
+
if lower_input == CMD_HISTORY:
|
259
|
+
# case-insensitive
|
256
260
|
if not self.chat.history:
|
257
261
|
self.console.print("History is empty.", style="yellow")
|
258
262
|
else:
|
@@ -269,15 +273,17 @@ class CLI:
|
|
269
273
|
return True
|
270
274
|
|
271
275
|
# Handle /save command - optional title parameter
|
272
|
-
if
|
273
|
-
|
276
|
+
if lower_input.startswith(CMD_SAVE_CHAT):
|
277
|
+
# Save chat with title from user raw input, case-sensitive
|
278
|
+
parts = user_input.split(maxsplit=1)
|
274
279
|
title = parts[1] if len(parts) > 1 else self.chat.title
|
275
280
|
self._save_chat(title)
|
276
281
|
return True
|
277
282
|
|
278
283
|
# Handle /load command - requires index parameter
|
279
|
-
if
|
280
|
-
|
284
|
+
if lower_input.startswith(CMD_LOAD_CHAT):
|
285
|
+
# Load chat by index from user raw input, case-sensitive
|
286
|
+
parts = user_input.split(maxsplit=1)
|
281
287
|
if len(parts) == 2 and parts[1].isdigit():
|
282
288
|
# Try to parse as an index first
|
283
289
|
self._load_chat_by_index(index=parts[1])
|
@@ -287,8 +293,9 @@ class CLI:
|
|
287
293
|
return True
|
288
294
|
|
289
295
|
# Handle /delete command - requires index parameter
|
290
|
-
if
|
291
|
-
|
296
|
+
if lower_input.startswith(CMD_DELETE_CHAT):
|
297
|
+
# Delete chat by index from user raw input, case-sensitive
|
298
|
+
parts = user_input.split(maxsplit=1)
|
292
299
|
if len(parts) == 2 and parts[1].isdigit():
|
293
300
|
self._delete_chat_by_index(index=parts[1])
|
294
301
|
else:
|
@@ -297,13 +304,15 @@ class CLI:
|
|
297
304
|
return True
|
298
305
|
|
299
306
|
# Handle /list command to list saved chats
|
300
|
-
if
|
307
|
+
if lower_input == CMD_LIST_CHATS:
|
308
|
+
# case-insensitive
|
301
309
|
self._list_chats()
|
302
310
|
return True
|
303
311
|
|
304
312
|
# Handle /mode command
|
305
|
-
if
|
306
|
-
|
313
|
+
if lower_input.startswith(CMD_MODE):
|
314
|
+
# Switch mode by lower user input, case-insensitive
|
315
|
+
parts = lower_input.split(maxsplit=1)
|
307
316
|
if len(parts) == 2 and parts[1] in [CHAT_MODE, EXEC_MODE]:
|
308
317
|
new_mode = parts[1]
|
309
318
|
if self.current_mode != new_mode:
|
yaicli/printer.py
CHANGED
@@ -93,13 +93,7 @@ class Printer:
|
|
93
93
|
"""
|
94
94
|
# Process reasoning field first (if present)
|
95
95
|
if chunk_reasoning:
|
96
|
-
|
97
|
-
# Already in reasoning mode, append to reasoning
|
98
|
-
reasoning += chunk_reasoning
|
99
|
-
else:
|
100
|
-
# Force reasoning mode for explicit reasoning field
|
101
|
-
self.in_reasoning = True
|
102
|
-
reasoning += chunk_reasoning
|
96
|
+
reasoning += chunk_reasoning
|
103
97
|
|
104
98
|
# Then process content field (if present)
|
105
99
|
if chunk_content:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: yaicli
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.6
|
4
4
|
Summary: A simple CLI tool to interact with LLM
|
5
5
|
Project-URL: Homepage, https://github.com/belingud/yaicli
|
6
6
|
Project-URL: Repository, https://github.com/belingud/yaicli
|
@@ -232,6 +232,7 @@ Description-Content-Type: text/markdown
|
|
232
232
|
<img src="artwork/logo.png" width="150" alt="YAICLI Logo" />
|
233
233
|
</p>
|
234
234
|
|
235
|
+
<a href="https://www.producthunt.com/posts/yaicli?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-yaicli" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=965413&theme=neutral&t=1747386335651" alt="Yaicli - Yaicli: Your AI assistant in the command line. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
235
236
|
|
236
237
|
[](https://pypi.org/project/yaicli/)
|
237
238
|

|
@@ -480,50 +481,50 @@ ai --verbose "Explain quantum computing"
|
|
480
481
|
YAICLI: Your AI assistant in the command line.
|
481
482
|
Call with a PROMPT to get a direct answer, use --shell to execute as command, or use --chat for an interactive session.
|
482
483
|
|
483
|
-
╭─ Arguments
|
484
|
-
│ prompt [PROMPT] The prompt to send to the LLM. Reads from stdin if available. [default: None]
|
485
|
-
|
486
|
-
╭─ Options
|
487
|
-
│ --install-completion Install completion for the current shell.
|
488
|
-
│ --show-completion Show completion for the current shell, to copy it or customize the installation.
|
489
|
-
│ --help -h Show this message and exit.
|
490
|
-
|
491
|
-
╭─ LLM Options
|
492
|
-
│ --model -M TEXT Specify the model to use.
|
493
|
-
│ --temperature -T FLOAT RANGE [0.0<=x<=2.0] Specify the temperature to use. [default: 0.5]
|
494
|
-
│ --top-p -P FLOAT RANGE [0.0<=x<=1.0] Specify the top-p to use. [default: 1.0]
|
495
|
-
│ --max-tokens
|
496
|
-
│ --stream --no-stream Specify whether to stream the response. (default: stream)
|
497
|
-
|
498
|
-
╭─ Role Options
|
499
|
-
│ --role -r TEXT Specify the assistant role to use. [default: DEFAULT]
|
500
|
-
│ --create-role TEXT Create a new role with the specified name.
|
501
|
-
│ --delete-role TEXT Delete a role with the specified name.
|
502
|
-
│ --list-roles List all available roles.
|
503
|
-
│ --show-role TEXT Show the role with the specified name.
|
504
|
-
|
505
|
-
╭─ Chat Options
|
506
|
-
│ --chat -c Start in interactive chat mode.
|
507
|
-
│ --list-chats List saved chat sessions.
|
508
|
-
|
509
|
-
╭─ Shell Options
|
510
|
-
│ --shell -s Generate and optionally execute a shell command (non-interactive).
|
511
|
-
|
512
|
-
╭─ Code Options
|
513
|
-
│ --code Generate code in plaintext (non-interactive).
|
514
|
-
|
515
|
-
╭─ Other Options
|
516
|
-
│ --verbose -V Show verbose output (e.g., loaded config).
|
517
|
-
│ --template Show the default config file template and exit.
|
518
|
-
│ --show-reasoning --hide-reasoning Show reasoning content from the LLM. (default: show)
|
519
|
-
│ --justify -j [default|left|center|right|full] Specify the justify to use. [default: default]
|
520
|
-
|
521
|
-
╭─ Function Options
|
522
|
-
│ --install-functions Install default functions.
|
523
|
-
│ --list-functions List all available functions.
|
524
|
-
│ --enable-functions --disable-functions Enable/disable function calling in API requests (default: disabled)
|
525
|
-
│ --show-function-output --hide-function-output Show the output of functions (default: show)
|
526
|
-
|
484
|
+
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
485
|
+
│ prompt [PROMPT] The prompt to send to the LLM. Reads from stdin if available. [default: None] │
|
486
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
487
|
+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
488
|
+
│ --install-completion Install completion for the current shell. │
|
489
|
+
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
|
490
|
+
│ --help -h Show this message and exit. │
|
491
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
492
|
+
╭─ LLM Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
493
|
+
│ --model -M TEXT Specify the model to use. │
|
494
|
+
│ --temperature -T FLOAT RANGE [0.0<=x<=2.0] Specify the temperature to use. [default: 0.5] │
|
495
|
+
│ --top-p -P FLOAT RANGE [0.0<=x<=1.0] Specify the top-p to use. [default: 1.0] │
|
496
|
+
│ --max-tokens INTEGER RANGE [x>=1] Specify the max tokens to use. [default: 1024] │
|
497
|
+
│ --stream --no-stream Specify whether to stream the response. (default: stream) │
|
498
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
499
|
+
╭─ Role Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
500
|
+
│ --role -r TEXT Specify the assistant role to use. [default: DEFAULT] │
|
501
|
+
│ --create-role TEXT Create a new role with the specified name. │
|
502
|
+
│ --delete-role TEXT Delete a role with the specified name. │
|
503
|
+
│ --list-roles List all available roles. │
|
504
|
+
│ --show-role TEXT Show the role with the specified name. │
|
505
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
506
|
+
╭─ Chat Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
507
|
+
│ --chat -c Start in interactive chat mode. │
|
508
|
+
│ --list-chats List saved chat sessions. │
|
509
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
510
|
+
╭─ Shell Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
511
|
+
│ --shell -s Generate and optionally execute a shell command (non-interactive). │
|
512
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
513
|
+
╭─ Code Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
514
|
+
│ --code Generate code in plaintext (non-interactive). │
|
515
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
516
|
+
╭─ Other Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
517
|
+
│ --verbose -V Show verbose output (e.g., loaded config). │
|
518
|
+
│ --template Show the default config file template and exit. │
|
519
|
+
│ --show-reasoning --hide-reasoning Show reasoning content from the LLM. (default: show) │
|
520
|
+
│ --justify -j [default|left|center|right|full] Specify the justify to use. [default: default] │
|
521
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
522
|
+
╭─ Function Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
523
|
+
│ --install-functions Install default functions. │
|
524
|
+
│ --list-functions List all available functions. │
|
525
|
+
│ --enable-functions --disable-functions Enable/disable function calling in API requests (default: disabled) │
|
526
|
+
│ --show-function-output --hide-function-output Show the output of functions (default: show) │
|
527
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
527
528
|
```
|
528
529
|
|
529
530
|
### Interactive Mode Features
|
@@ -1,7 +1,7 @@
|
|
1
|
-
pyproject.toml,sha256=
|
1
|
+
pyproject.toml,sha256=6p1uC3kyuCkJEw7qEwIFWQ2wgiAV9fqpDmGr6u9hsAs,1963
|
2
2
|
yaicli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
yaicli/chat.py,sha256=DeTmOeBPU-oiOAIaDj2h-auJor0GyVVhrViLYF6zGIM,13638
|
4
|
-
yaicli/cli.py,sha256=
|
4
|
+
yaicli/cli.py,sha256=1Flt0FgrKzbabjJpZJCcvnUjXaaLwyD2paRyMixEQV0,22985
|
5
5
|
yaicli/client.py,sha256=fKUDmn9s7tF9Q2wIB8WhbsjFYIpV0E29t_Vw0qVmVbI,16229
|
6
6
|
yaicli/config.py,sha256=_mp8P6zXyrdp4TzBfHraOCkjv5DMZMOwiEhQnFYWwZA,6321
|
7
7
|
yaicli/console.py,sha256=vARPJd-3lafutsQWrGntQVjLrYqaJD3qisN82pmuhjU,1973
|
@@ -9,7 +9,7 @@ yaicli/const.py,sha256=FYW8cNqFzZwnYbgr_HXZSzSS8OIU_UsFIn4SZ0zOJ8U,8129
|
|
9
9
|
yaicli/entry.py,sha256=gKzN8Yar3tpBd2Z2a80gD3k0W4Sf3lL7jdyws-2y-H0,8687
|
10
10
|
yaicli/exceptions.py,sha256=WBYg8OTJJzaj7lt6HE7ZyBoe5T6A3yZRNCRfWd4iN0c,372
|
11
11
|
yaicli/history.py,sha256=s-57X9FMsaQHF7XySq1gGH_jpd_cHHTYafYu2ECuG6M,2472
|
12
|
-
yaicli/printer.py,sha256=
|
12
|
+
yaicli/printer.py,sha256=a409R_4-ppNnen31Pt7KvaaNAFVCzBARYC0T0_EtMbU,8369
|
13
13
|
yaicli/render.py,sha256=k8o2P8fI44PJlyQbs7gmMiu2x2prwajdWn5JIt15BIA,505
|
14
14
|
yaicli/role.py,sha256=PfwiVJIlzg7EzlvMM-kIy6vBK0d5d_J4M1I_fIZGnWk,7399
|
15
15
|
yaicli/schemas.py,sha256=PiuSY7ORZaA4OL_tYm0inwqirHp5M-F3zcCipLwsH9E,571
|
@@ -17,8 +17,8 @@ yaicli/tools.py,sha256=d-5LXbEB-1Uq5VKSgwlAiNDVOGrHkku2DpmZoorq1zw,3098
|
|
17
17
|
yaicli/utils.py,sha256=bpo3Xhozpxsaci3FtEIKZ32l4ZdyWMsrHjYGX0tB4J4,4541
|
18
18
|
yaicli/functions/__init__.py,sha256=_FJooQ9GkijG8xLwuU0cr5GBrGnC9Nc6bnCeUjrsT0k,1271
|
19
19
|
yaicli/functions/buildin/execute_shell_command.py,sha256=unl1-F8p6QZajeHdA0u5UpURMJM0WhdWMUWCCCHVRcI,1320
|
20
|
-
yaicli-0.5.
|
21
|
-
yaicli-0.5.
|
22
|
-
yaicli-0.5.
|
23
|
-
yaicli-0.5.
|
24
|
-
yaicli-0.5.
|
20
|
+
yaicli-0.5.6.dist-info/METADATA,sha256=Vxp8bZrO89wYwWhtXB00o_2XVyF-6UyprAQd8bfVh1g,49194
|
21
|
+
yaicli-0.5.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
22
|
+
yaicli-0.5.6.dist-info/entry_points.txt,sha256=iYVyQP0PJIm9tQnlQheqT435kK_xdGoi5j9aswGV9hA,66
|
23
|
+
yaicli-0.5.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
24
|
+
yaicli-0.5.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|