codegpt-ai 1.23.0 → 1.25.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 +62 -154
- package/package.json +1 -1
package/chat.py
CHANGED
|
@@ -1170,108 +1170,45 @@ def print_header(model):
|
|
|
1170
1170
|
compact = is_compact()
|
|
1171
1171
|
console.print()
|
|
1172
1172
|
|
|
1173
|
-
# Responsive logo
|
|
1174
|
-
logo = LOGO_COMPACT if compact else LOGO_FULL
|
|
1175
|
-
console.print(Panel(
|
|
1176
|
-
Text.from_markup(logo),
|
|
1177
|
-
border_style="bright_cyan",
|
|
1178
|
-
padding=(0 if compact else 1, 1 if compact else 2),
|
|
1179
|
-
width=w,
|
|
1180
|
-
))
|
|
1181
|
-
|
|
1182
|
-
# Status bar — compact version for small screens
|
|
1183
|
-
now = datetime.now().strftime("%H:%M")
|
|
1184
|
-
elapsed = int(time.time() - session_stats["start"])
|
|
1185
|
-
uptime = f"{elapsed // 60}m"
|
|
1186
|
-
tok = session_stats["tokens_out"]
|
|
1187
|
-
|
|
1188
|
-
bar = Text()
|
|
1189
1173
|
if compact:
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
bar.append(f" {now}", style="dim")
|
|
1174
|
+
console.print(Text.from_markup(f" [bold bright_cyan]CodeGPT[/] [dim]· {model}[/]"))
|
|
1175
|
+
console.print(Rule(style="dim", characters="─"))
|
|
1193
1176
|
else:
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1177
|
+
console.print(Text.from_markup(LOGO_FULL))
|
|
1178
|
+
console.print()
|
|
1179
|
+
now = datetime.now().strftime("%H:%M")
|
|
1180
|
+
elapsed = int(time.time() - session_stats["start"])
|
|
1181
|
+
console.print(Text.from_markup(
|
|
1182
|
+
f" [bright_cyan]{model}[/]"
|
|
1183
|
+
f" [dim]·[/] [dim]{session_stats['messages']} msgs[/]"
|
|
1184
|
+
f" [dim]·[/] [dim]{session_stats['tokens_out']} tok[/]"
|
|
1185
|
+
f" [dim]·[/] [dim]{elapsed // 60}m[/]"
|
|
1186
|
+
f" [dim]·[/] [dim]{now}[/]"
|
|
1187
|
+
))
|
|
1188
|
+
console.print(Rule(style="dim", characters="─"))
|
|
1205
1189
|
console.print()
|
|
1206
1190
|
|
|
1207
1191
|
|
|
1208
1192
|
def print_welcome(model, available_models):
|
|
1209
1193
|
w = tw()
|
|
1210
1194
|
import random
|
|
1211
|
-
|
|
1212
|
-
# Greeting
|
|
1213
|
-
hour = datetime.now().hour
|
|
1214
|
-
if hour < 12:
|
|
1215
|
-
greeting = "Good morning"
|
|
1216
|
-
elif hour < 18:
|
|
1217
|
-
greeting = "Good afternoon"
|
|
1218
|
-
else:
|
|
1219
|
-
greeting = "Good evening"
|
|
1220
|
-
|
|
1221
1195
|
compact = is_compact()
|
|
1222
1196
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
model_count = len(available_models)
|
|
1229
|
-
mem_count = len(load_memories())
|
|
1230
|
-
profile = load_profile()
|
|
1231
|
-
streak = profile.get("total_sessions", 0)
|
|
1197
|
+
# Clean welcome — no heavy panels
|
|
1198
|
+
hour = datetime.now().hour
|
|
1199
|
+
greeting = "Good morning" if hour < 12 else "Good afternoon" if hour < 18 else "Good evening"
|
|
1200
|
+
console.print(Text(f" {greeting}. How can I help?", style="bold white"))
|
|
1201
|
+
console.print()
|
|
1232
1202
|
|
|
1233
|
-
|
|
1234
|
-
if compact:
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
else:
|
|
1239
|
-
status.append(" ◈ ", style="bright_cyan")
|
|
1240
|
-
status.append(f"{model}", style="bold bright_cyan")
|
|
1241
|
-
status.append(" │ ", style="dim")
|
|
1242
|
-
status.append(f"◇ {server_type}", style="green" if model_count > 0 else "red")
|
|
1243
|
-
status.append(" │ ", style="dim")
|
|
1244
|
-
status.append(f"△ {model_count} models", style="dim")
|
|
1245
|
-
status.append(" │ ", style="dim")
|
|
1246
|
-
status.append(f"◇ {mem_count} memories", style="dim")
|
|
1247
|
-
if streak > 1:
|
|
1248
|
-
status.append(" │ ", style="dim")
|
|
1249
|
-
status.append(f"▸ {streak} sessions", style="dim")
|
|
1250
|
-
console.print(Panel(status, border_style="bright_black", padding=0, width=w))
|
|
1251
|
-
|
|
1252
|
-
# Suggestion chips — fewer on compact
|
|
1253
|
-
if compact:
|
|
1254
|
-
console.print(Panel(
|
|
1255
|
-
_build_suggestions(max_items=3),
|
|
1256
|
-
title="[dim]Try[/]",
|
|
1257
|
-
title_align="left",
|
|
1258
|
-
border_style="bright_black",
|
|
1259
|
-
padding=(0, 1),
|
|
1260
|
-
width=w,
|
|
1261
|
-
))
|
|
1262
|
-
else:
|
|
1263
|
-
console.print(Panel(
|
|
1264
|
-
_build_suggestions(),
|
|
1265
|
-
title="[dim]Suggestions (type a number)[/]",
|
|
1266
|
-
title_align="left",
|
|
1267
|
-
border_style="bright_black",
|
|
1268
|
-
padding=(1, 2),
|
|
1269
|
-
width=w,
|
|
1270
|
-
))
|
|
1203
|
+
# Suggestions — clean list
|
|
1204
|
+
items = SUGGESTIONS[:3] if compact else SUGGESTIONS[:5]
|
|
1205
|
+
for i, s in enumerate(items, 1):
|
|
1206
|
+
console.print(Text.from_markup(f" [bright_cyan]{i}.[/] [dim]{s}[/]"))
|
|
1207
|
+
console.print()
|
|
1271
1208
|
|
|
1272
|
-
# Tip
|
|
1209
|
+
# Tip
|
|
1273
1210
|
tip = random.choice(TIPS)
|
|
1274
|
-
console.print(Text(f"
|
|
1211
|
+
console.print(Text(f" tip: {tip}", style="dim italic"))
|
|
1275
1212
|
console.print()
|
|
1276
1213
|
|
|
1277
1214
|
|
|
@@ -1289,46 +1226,40 @@ def _build_suggestions(max_items=None):
|
|
|
1289
1226
|
|
|
1290
1227
|
|
|
1291
1228
|
def print_user_msg(text):
|
|
1292
|
-
|
|
1293
|
-
console.print(
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
title_align="left",
|
|
1297
|
-
border_style="bright_cyan",
|
|
1298
|
-
padding=pad,
|
|
1299
|
-
width=tw(),
|
|
1300
|
-
))
|
|
1229
|
+
# Clean inline style like Claude Code — no heavy panels
|
|
1230
|
+
console.print()
|
|
1231
|
+
console.print(Text(f" {text}", style="bold white"))
|
|
1232
|
+
console.print()
|
|
1301
1233
|
|
|
1302
1234
|
|
|
1303
1235
|
def print_ai_msg(text, stats=""):
|
|
1304
|
-
|
|
1236
|
+
# Minimal border, clean markdown — like Claude Code output
|
|
1237
|
+
w = tw()
|
|
1305
1238
|
compact = is_compact()
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
padding=pad,
|
|
1314
|
-
width=tw(),
|
|
1315
|
-
)
|
|
1316
|
-
print_with_sidebar(panel)
|
|
1239
|
+
|
|
1240
|
+
console.print(Rule(style="bright_green", characters="─"))
|
|
1241
|
+
console.print()
|
|
1242
|
+
console.print(Markdown(text), width=w - 4)
|
|
1243
|
+
if stats and not compact:
|
|
1244
|
+
console.print(Text(f" {stats}", style="dim"))
|
|
1245
|
+
console.print()
|
|
1317
1246
|
|
|
1318
1247
|
|
|
1319
1248
|
def print_sys(text):
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
else:
|
|
1323
|
-
console.print(Panel(
|
|
1324
|
-
Text(text, style="dim italic"),
|
|
1325
|
-
border_style="bright_black",
|
|
1326
|
-
padding=(0, 1),
|
|
1327
|
-
width=tw(),
|
|
1328
|
-
))
|
|
1249
|
+
# Simple dim text — no panels, no borders
|
|
1250
|
+
console.print(Text(f" {text}", style="dim"))
|
|
1329
1251
|
|
|
1330
1252
|
|
|
1331
1253
|
def print_err(text):
|
|
1254
|
+
console.print(Text(f" ✗ {text}", style="bold red"))
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
def print_success(text):
|
|
1258
|
+
console.print(Text(f" ✓ {text}", style="bold green"))
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
def _print_err_panel(text):
|
|
1262
|
+
"""Legacy panel error for important errors."""
|
|
1332
1263
|
console.print(Panel(
|
|
1333
1264
|
Text(text, style="bold red"),
|
|
1334
1265
|
title="[bold red]Error[/]",
|
|
@@ -4241,21 +4172,21 @@ def stream_response(messages, system, model):
|
|
|
4241
4172
|
# --- Input ---
|
|
4242
4173
|
|
|
4243
4174
|
def _bottom_toolbar():
|
|
4244
|
-
"""
|
|
4175
|
+
"""Clean status bar like Claude Code."""
|
|
4245
4176
|
elapsed = int(time.time() - session_stats["start"])
|
|
4246
4177
|
mins = elapsed // 60
|
|
4247
4178
|
msgs = session_stats["messages"]
|
|
4248
4179
|
tok = session_stats["tokens_out"]
|
|
4249
4180
|
if is_compact():
|
|
4250
|
-
return [("class:bottom-toolbar", f" {msgs}
|
|
4181
|
+
return [("class:bottom-toolbar", f" {msgs} msgs · {tok} tok · {mins}m ")]
|
|
4251
4182
|
return [("class:bottom-toolbar",
|
|
4252
|
-
f" {msgs} msgs
|
|
4183
|
+
f" {msgs} msgs · {tok} tokens · {mins}m · type / for commands ")]
|
|
4253
4184
|
|
|
4254
4185
|
|
|
4255
4186
|
def get_input():
|
|
4256
4187
|
try:
|
|
4257
4188
|
return prompt(
|
|
4258
|
-
[("class:prompt", "
|
|
4189
|
+
[("class:prompt", " ❯ ")],
|
|
4259
4190
|
style=input_style,
|
|
4260
4191
|
history=input_history,
|
|
4261
4192
|
completer=cmd_completer,
|
|
@@ -5761,30 +5692,14 @@ def main():
|
|
|
5761
5692
|
}
|
|
5762
5693
|
alt = alternatives.get(tool_key, "Check /tools for available alternatives")
|
|
5763
5694
|
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
title="[bold red]Not Available[/]",
|
|
5773
|
-
border_style="red", padding=(0, 1), width=tw(),
|
|
5774
|
-
))
|
|
5775
|
-
else:
|
|
5776
|
-
console.print(Panel(
|
|
5777
|
-
Text.from_markup(
|
|
5778
|
-
f"[bold red]{tool['name']} is not available on Termux[/]\n\n"
|
|
5779
|
-
f" [bold]Why:[/]\n"
|
|
5780
|
-
f" {reason}\n\n"
|
|
5781
|
-
f" [bold]Alternatives:[/]\n"
|
|
5782
|
-
f" [bright_cyan]{alt}[/]\n\n"
|
|
5783
|
-
f" [dim]Or use this tool on your PC instead.[/]"
|
|
5784
|
-
),
|
|
5785
|
-
title="[bold red]Not Supported[/]",
|
|
5786
|
-
border_style="red", padding=(1, 2), width=tw(),
|
|
5787
|
-
))
|
|
5695
|
+
console.print()
|
|
5696
|
+
console.print(Text.from_markup(f" [bold red]✗ {tool['name']} — not available on Termux[/]"))
|
|
5697
|
+
console.print()
|
|
5698
|
+
console.print(Text.from_markup(f" [bold]Why:[/] {reason}"))
|
|
5699
|
+
console.print()
|
|
5700
|
+
console.print(Text.from_markup(f" [bold]Try instead:[/] [bright_cyan]{alt}[/]"))
|
|
5701
|
+
console.print(Text(" Or use this tool on your PC.", style="dim"))
|
|
5702
|
+
console.print()
|
|
5788
5703
|
continue
|
|
5789
5704
|
tool_args = user_input[len(cmd):].strip()
|
|
5790
5705
|
|
|
@@ -5862,13 +5777,6 @@ def main():
|
|
|
5862
5777
|
print_sys("Back to CodeGPT.")
|
|
5863
5778
|
audit_log(f"TOOL_EXIT", tool_key)
|
|
5864
5779
|
else:
|
|
5865
|
-
# Check platform support
|
|
5866
|
-
is_termux = os.path.exists("/data/data/com.termux")
|
|
5867
|
-
if is_termux and not tool.get("termux", True):
|
|
5868
|
-
print_err(f"{tool['name']} doesn't support Termux/ARM.")
|
|
5869
|
-
print_sys("Use a desktop/PC for this tool.")
|
|
5870
|
-
continue
|
|
5871
|
-
|
|
5872
5780
|
# Pick platform-specific install command
|
|
5873
5781
|
if is_termux and "install_termux" in tool:
|
|
5874
5782
|
install_cmd = list(tool["install_termux"])
|