codegpt-ai 2.26.0 → 2.27.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tui.py +33 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codegpt-ai",
3
- "version": "2.26.0",
3
+ "version": "2.27.0",
4
4
  "description": "Local AI Assistant Hub — 123 commands, 26 tools, 8 agents, multi-AI, security. No cloud needed.",
5
5
  "author": "ArukuX",
6
6
  "license": "MIT",
package/tui.py CHANGED
@@ -17,6 +17,7 @@ from rich.rule import Rule
17
17
  from rich.align import Align
18
18
  from prompt_toolkit import prompt
19
19
  from prompt_toolkit.history import InMemoryHistory
20
+ from prompt_toolkit.completion import Completer, Completion
20
21
  from prompt_toolkit.styles import Style as PtStyle
21
22
 
22
23
  # Config
@@ -105,6 +106,36 @@ if profile_file.exists():
105
106
  OLLAMA_BASE = OLLAMA_URL.replace("/api/chat", "")
106
107
 
107
108
  console = Console()
109
+
110
+ TUI_COMMANDS = {
111
+ "/help": "Show all commands",
112
+ "/new": "New conversation",
113
+ "/model": "Switch model",
114
+ "/models": "List all models",
115
+ "/persona": "Switch persona",
116
+ "/think": "Toggle deep thinking",
117
+ "/tokens": "Token count",
118
+ "/clear": "Clear screen",
119
+ "/sidebar": "Toggle sidebar",
120
+ "/history": "Show history",
121
+ "/connect": "Connect to remote Ollama",
122
+ "/server": "Server info",
123
+ "/weather": "Get weather",
124
+ "/agent": "Run an AI agent",
125
+ "/quit": "Exit",
126
+ }
127
+
128
+
129
+ class TuiCompleter(Completer):
130
+ def get_completions(self, document, complete_event):
131
+ text = document.text_before_cursor.lstrip()
132
+ if text.startswith("/"):
133
+ typed = text.lower()
134
+ for cmd, desc in TUI_COMMANDS.items():
135
+ if cmd.startswith(typed):
136
+ yield Completion(cmd, start_position=-len(text), display=cmd, display_meta=desc)
137
+
138
+ cmd_completer = TuiCompleter()
108
139
  history = InMemoryHistory()
109
140
  style = PtStyle.from_dict({
110
141
  "prompt": "ansicyan bold",
@@ -408,6 +439,8 @@ def main():
408
439
  [("class:prompt", " ❯ ")],
409
440
  style=style,
410
441
  history=history,
442
+ completer=cmd_completer,
443
+ complete_while_typing=True,
411
444
  bottom_toolbar=toolbar,
412
445
  ).strip()
413
446
  except (KeyboardInterrupt, EOFError):