yaicli 0.5.4__py3-none-any.whl → 0.5.5__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "yaicli"
3
- version = "0.5.4"
3
+ version = "0.5.5"
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"
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
- command = user_input.lower().strip()
246
- if command in CMD_HELP:
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 command == CMD_EXIT:
250
+ if lower_input == CMD_EXIT:
251
+ # case-insensitive
250
252
  return False
251
- if command == CMD_CLEAR and self.current_mode == CHAT_MODE:
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 command == CMD_HISTORY:
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 command.startswith(CMD_SAVE_CHAT):
273
- parts = command.split(maxsplit=1)
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 command.startswith(CMD_LOAD_CHAT):
280
- parts = command.split(maxsplit=1)
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 command.startswith(CMD_DELETE_CHAT):
291
- parts = command.split(maxsplit=1)
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 command == CMD_LIST_CHATS:
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 command.startswith(CMD_MODE):
306
- parts = command.split(maxsplit=1)
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yaicli
3
- Version: 0.5.4
3
+ Version: 0.5.5
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&#0058;&#0032;Your&#0032;AI&#0032;assistant&#0032;in&#0032;the&#0032;command&#0032;line&#0046; | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
235
236
 
236
237
  [![PyPI version](https://img.shields.io/pypi/v/yaicli?style=for-the-badge)](https://pypi.org/project/yaicli/)
237
238
  ![GitHub License](https://img.shields.io/github/license/belingud/yaicli?style=for-the-badge)
@@ -1,7 +1,7 @@
1
- pyproject.toml,sha256=wulFxcG4kdxn2bVtpqubf8CFQc1Tj7aiA3qYJzXOeyo,1615
1
+ pyproject.toml,sha256=bFPTKVIFeSvLyWCIEZPvU_jtlcuOyrAv55R0XDudNzM,1615
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=XY-xfB_kGHeBaNo17iI1OtEuuC2YIGW2WG4k87coX_Y,22502
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
@@ -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.4.dist-info/METADATA,sha256=FtAMYGH-hL75N-DDRWZXY4X1h_SzoqUb7goJTB49Z-o,48811
21
- yaicli-0.5.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- yaicli-0.5.4.dist-info/entry_points.txt,sha256=iYVyQP0PJIm9tQnlQheqT435kK_xdGoi5j9aswGV9hA,66
23
- yaicli-0.5.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- yaicli-0.5.4.dist-info/RECORD,,
20
+ yaicli-0.5.5.dist-info/METADATA,sha256=xP25HRcZiT53Wqr9w7d6gupEmMxuBQRuTzv8FcMdxwM,49274
21
+ yaicli-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ yaicli-0.5.5.dist-info/entry_points.txt,sha256=iYVyQP0PJIm9tQnlQheqT435kK_xdGoi5j9aswGV9hA,66
23
+ yaicli-0.5.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ yaicli-0.5.5.dist-info/RECORD,,
File without changes