codegpt-ai 2.0.0 → 2.3.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 +73 -11
- 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()}
|
|
@@ -1172,9 +1222,13 @@ def print_header(model):
|
|
|
1172
1222
|
compact = is_compact()
|
|
1173
1223
|
|
|
1174
1224
|
if compact:
|
|
1175
|
-
console.print(
|
|
1225
|
+
console.print()
|
|
1226
|
+
console.print(Text.from_markup(
|
|
1227
|
+
f" [bold red]Code[/][bold bright_blue]GPT[/] [dim]v2.0 · {model}[/]"
|
|
1228
|
+
))
|
|
1229
|
+
console.print(Rule(style="dim", characters="─"))
|
|
1230
|
+
console.print()
|
|
1176
1231
|
else:
|
|
1177
|
-
# Clean startup like Claude Code — no ASCII art on repeat, just info
|
|
1178
1232
|
is_local = "localhost" in OLLAMA_URL or "127.0.0.1" in OLLAMA_URL
|
|
1179
1233
|
server = "local" if is_local else OLLAMA_URL.split("//")[1].split("/")[0] if "//" in OLLAMA_URL else "?"
|
|
1180
1234
|
profile = load_profile()
|
|
@@ -1182,15 +1236,23 @@ def print_header(model):
|
|
|
1182
1236
|
mem_count = len(load_memories())
|
|
1183
1237
|
|
|
1184
1238
|
console.print()
|
|
1185
|
-
|
|
1239
|
+
# Claude Code style banner — red and blue
|
|
1240
|
+
console.print(Text.from_markup(
|
|
1241
|
+
"[bold red] ╭─────────────────────────────────╮[/]\n"
|
|
1242
|
+
"[bold red] │[/] [bold red]│[/]\n"
|
|
1243
|
+
"[bold red] │[/] [bold red]Code[/][bold bright_blue]GPT[/] [dim]v2.0[/] [bold red]│[/]\n"
|
|
1244
|
+
"[bold red] │[/] [dim]local ai · 123 commands[/] [bold red]│[/]\n"
|
|
1245
|
+
"[bold red] │[/] [bold red]│[/]\n"
|
|
1246
|
+
"[bold red] ╰─────────────────────────────────╯[/]"
|
|
1247
|
+
))
|
|
1186
1248
|
console.print()
|
|
1187
1249
|
console.print(Text.from_markup(
|
|
1188
|
-
f" [dim]model[/] [
|
|
1250
|
+
f" [dim]model[/] [bright_blue]{model}[/]\n"
|
|
1189
1251
|
f" [dim]server[/] [green]{server}[/]\n"
|
|
1190
1252
|
f" [dim]user[/] {name}\n"
|
|
1191
|
-
f" [dim]memory[/] {mem_count} items
|
|
1192
|
-
f" [dim]commands[/] {len(COMMANDS)}"
|
|
1253
|
+
f" [dim]memory[/] {mem_count} items"
|
|
1193
1254
|
))
|
|
1255
|
+
console.print(Rule(style="dim", characters="─"))
|
|
1194
1256
|
console.print()
|
|
1195
1257
|
|
|
1196
1258
|
|