codegpt-ai 2.0.0 → 2.2.0
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.
- package/chat.py +55 -5
- package/package.json +1 -1
package/chat.py
CHANGED
|
@@ -473,31 +473,76 @@ try:
|
|
|
473
473
|
input_history = FileHistory(str(_hist_path))
|
|
474
474
|
except Exception:
|
|
475
475
|
input_history = InMemoryHistory()
|
|
476
|
+
# Command categories for autocomplete display
|
|
477
|
+
CMD_CATEGORIES = {}
|
|
478
|
+
_cat_map = {
|
|
479
|
+
"Chat": ["/new", "/save", "/load", "/delete", "/copy", "/regen", "/edit", "/history", "/clear", "/quit"],
|
|
480
|
+
"Model": ["/model", "/modelinfo", "/params", "/temp", "/think", "/tokens", "/compact", "/system"],
|
|
481
|
+
"AI Agents": ["/agent", "/agents", "/all", "/vote", "/swarm", "/team", "/room", "/spectate", "/dm", "/chat-link"],
|
|
482
|
+
"AI Lab": ["/lab", "/chain", "/race", "/prompts", "/compare"],
|
|
483
|
+
"Tools": ["/tools", "/bg", "/split", "/splitv", "/grid", "/running", "/killall"],
|
|
484
|
+
"Connect": ["/connect", "/disconnect", "/server", "/qr", "/scan"],
|
|
485
|
+
"Files & Code": ["/file", "/run", "/code", "/shell", "/browse", "/open", "/export"],
|
|
486
|
+
"Memory": ["/mem", "/train", "/pin", "/pins", "/search", "/fork", "/rate", "/tag"],
|
|
487
|
+
"Profile": ["/profile", "/setname", "/setbio", "/persona", "/personas", "/usage"],
|
|
488
|
+
"Skills": ["/skill", "/skills", "/auto", "/cron", "/crons"],
|
|
489
|
+
"Comms": ["/broadcast", "/inbox", "/feed", "/monitor", "/hub"],
|
|
490
|
+
"System": ["/github", "/weather", "/spotify", "/volume", "/bright", "/sysinfo", "/voice", "/remind", "/reminders", "/shortcuts"],
|
|
491
|
+
"Security": ["/pin-set", "/pin-remove", "/lock", "/audit", "/security", "/permissions"],
|
|
492
|
+
}
|
|
493
|
+
for _cat, _cmds in _cat_map.items():
|
|
494
|
+
for _cmd in _cmds:
|
|
495
|
+
CMD_CATEGORIES[_cmd] = _cat
|
|
496
|
+
# Tools get their own category
|
|
497
|
+
for _tool_name in AI_TOOLS:
|
|
498
|
+
CMD_CATEGORIES[f"/{_tool_name}"] = "Tool"
|
|
499
|
+
CMD_CATEGORIES["/claude"] = "Tool"
|
|
500
|
+
CMD_CATEGORIES["/openclaw"] = "Tool"
|
|
501
|
+
CMD_CATEGORIES["/sidebar"] = "UI"
|
|
502
|
+
CMD_CATEGORIES["/diff"] = "Chat"
|
|
503
|
+
CMD_CATEGORIES["/help"] = "Help"
|
|
504
|
+
|
|
505
|
+
|
|
476
506
|
class SlashCompleter(Completer):
|
|
477
|
-
"""Show all commands when typing /"""
|
|
507
|
+
"""Show all commands with categories when typing /"""
|
|
478
508
|
def get_completions(self, document, complete_event):
|
|
479
509
|
text = document.text_before_cursor.lstrip()
|
|
480
510
|
if text.startswith("/"):
|
|
481
511
|
typed = text.lower()
|
|
482
512
|
on_termux = os.path.exists("/data/data/com.termux")
|
|
483
513
|
|
|
484
|
-
#
|
|
514
|
+
# Custom skills first
|
|
515
|
+
skills = load_skills()
|
|
516
|
+
for skill_name in skills:
|
|
517
|
+
cmd = f"/{skill_name}"
|
|
518
|
+
if cmd.startswith(typed):
|
|
519
|
+
yield Completion(
|
|
520
|
+
cmd,
|
|
521
|
+
start_position=-len(text),
|
|
522
|
+
display=f"{cmd}",
|
|
523
|
+
display_meta=f"skill: {skills[skill_name].get('desc', '')[:30]}",
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
# Main commands with categories
|
|
485
527
|
for cmd, desc in COMMANDS.items():
|
|
486
528
|
if cmd.startswith(typed):
|
|
487
|
-
# Skip tool commands that don't work on Termux
|
|
488
529
|
tool_name = cmd[1:]
|
|
489
530
|
if on_termux and tool_name in AI_TOOLS and not AI_TOOLS[tool_name].get("termux", True):
|
|
490
531
|
continue
|
|
532
|
+
cat = CMD_CATEGORIES.get(cmd, "")
|
|
533
|
+
meta = f"[{cat}] {desc}" if cat else desc
|
|
491
534
|
yield Completion(
|
|
492
535
|
cmd,
|
|
493
536
|
start_position=-len(text),
|
|
494
537
|
display=f"{cmd}",
|
|
495
|
-
display_meta=
|
|
538
|
+
display_meta=meta,
|
|
496
539
|
)
|
|
540
|
+
|
|
497
541
|
# Aliases
|
|
498
542
|
for alias, target in ALIASES.items():
|
|
499
543
|
if alias.startswith(typed) and alias not in COMMANDS:
|
|
500
544
|
desc = COMMANDS.get(target, "")
|
|
545
|
+
cat = CMD_CATEGORIES.get(target, "")
|
|
501
546
|
yield Completion(
|
|
502
547
|
alias,
|
|
503
548
|
start_position=-len(text),
|
|
@@ -508,7 +553,12 @@ class SlashCompleter(Completer):
|
|
|
508
553
|
cmd_completer = SlashCompleter()
|
|
509
554
|
input_style = PtStyle.from_dict({
|
|
510
555
|
"prompt": "ansicyan bold",
|
|
511
|
-
"bottom-toolbar": "bg:#1a1a2e #
|
|
556
|
+
"bottom-toolbar": "bg:#1a1a2e #888888",
|
|
557
|
+
"completion-menu": "bg:#1a1a2e #ffffff",
|
|
558
|
+
"completion-menu.completion": "bg:#1a1a2e #ffffff",
|
|
559
|
+
"completion-menu.completion.current": "bg:#00aaff #ffffff bold",
|
|
560
|
+
"completion-menu.meta.completion": "bg:#1a1a2e #888888",
|
|
561
|
+
"completion-menu.meta.completion.current": "bg:#00aaff #ffffff",
|
|
512
562
|
})
|
|
513
563
|
|
|
514
564
|
session_stats = {"messages": 0, "tokens_in": 0, "tokens_out": 0, "start": time.time()}
|