codegpt-ai 2.3.0 → 2.8.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 +100 -9
- package/package.json +1 -1
package/chat.py
CHANGED
|
@@ -1236,15 +1236,106 @@ def print_header(model):
|
|
|
1236
1236
|
mem_count = len(load_memories())
|
|
1237
1237
|
|
|
1238
1238
|
console.print()
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1239
|
+
|
|
1240
|
+
# Banner parts
|
|
1241
|
+
R = "bold red"
|
|
1242
|
+
B = "bold bright_blue"
|
|
1243
|
+
D = "dim"
|
|
1244
|
+
|
|
1245
|
+
# Fit to terminal width — no clipping
|
|
1246
|
+
w = min(console.width - 2, 56)
|
|
1247
|
+
|
|
1248
|
+
# Detailed spider models for each direction
|
|
1249
|
+
spiders = {
|
|
1250
|
+
"top": [
|
|
1251
|
+
f"[{D}] ╱╲[/]",
|
|
1252
|
+
f"[{D}] ╱╲(o.o)╱╲[/]",
|
|
1253
|
+
f"[{D}] ╱╱ ╲╱╱ ╲╲[/]",
|
|
1254
|
+
f"[{D}] ||[/]",
|
|
1255
|
+
],
|
|
1256
|
+
"right": [
|
|
1257
|
+
f"[{D}] ╱╲[/]",
|
|
1258
|
+
f"[{D}] (o.o)╲~~~[/]",
|
|
1259
|
+
f"[{D}] ╲╱[/]",
|
|
1260
|
+
],
|
|
1261
|
+
"bottom": [
|
|
1262
|
+
f"[{D}] ||[/]",
|
|
1263
|
+
f"[{D}] ╲╲ ╱╲╲ ╱╱[/]",
|
|
1264
|
+
f"[{D}] ╲╱(o.o)╲╱[/]",
|
|
1265
|
+
f"[{D}] ╲╱[/]",
|
|
1266
|
+
],
|
|
1267
|
+
"left": [
|
|
1268
|
+
f"[{D}] ╱╲[/]",
|
|
1269
|
+
f"[{D}]~~~╱(o.o)[/]",
|
|
1270
|
+
f"[{D}] ╲╱[/]",
|
|
1271
|
+
],
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
def build_banner(pos_name):
|
|
1275
|
+
"""Build banner with detailed spider at given position."""
|
|
1276
|
+
# Adaptive width border
|
|
1277
|
+
inner = w - 4 # inside the ║ ║
|
|
1278
|
+
pad = inner - 36 # 36 = content width
|
|
1279
|
+
lpad = pad // 2
|
|
1280
|
+
rpad = pad - lpad
|
|
1281
|
+
|
|
1282
|
+
top_b = f"[{R}] ╔{'═' * inner}╗[/]"
|
|
1283
|
+
bot_b = f"[{R}] ╚{'═' * inner}╝[/]"
|
|
1284
|
+
empty = f"[{R}] ║[/]{' ' * inner}[{R}]║[/]"
|
|
1285
|
+
title = f"[{R}] ║[/]{' ' * lpad}[{R}]C[/][{B}]o[/][{R}]d[/][{B}]e[/] [{R}]G[/][{B}]P[/][{R}]T[/] [{D}]v2.0[/]{' ' * (rpad + 16)}[{R}]║[/]"
|
|
1286
|
+
sub = f"[{R}] ║[/]{' ' * lpad}[{D}]local ai · powered by ollama[/]{' ' * (rpad + 7)}[{R}]║[/]"
|
|
1287
|
+
stats = f"[{R}] ║[/]{' ' * lpad}[{B}]123[/] [{D}]cmds ·[/] [{B}]26[/] [{D}]tools ·[/] [{B}]8[/] [{D}]agents[/]{' ' * (rpad + 8)}[{R}]║[/]"
|
|
1288
|
+
|
|
1289
|
+
lines = []
|
|
1290
|
+
|
|
1291
|
+
if pos_name == "top":
|
|
1292
|
+
for sl in spiders["top"]:
|
|
1293
|
+
lines.append(sl)
|
|
1294
|
+
lines.extend([top_b, empty, title, sub, stats, empty, bot_b])
|
|
1295
|
+
elif pos_name == "right":
|
|
1296
|
+
lines.extend([top_b, empty, title])
|
|
1297
|
+
# Spider on right side
|
|
1298
|
+
for i, sl in enumerate(spiders["right"]):
|
|
1299
|
+
if i == 0:
|
|
1300
|
+
lines.append(f"{sub} {sl}")
|
|
1301
|
+
elif i == 1:
|
|
1302
|
+
lines.append(f"{stats} {sl}")
|
|
1303
|
+
else:
|
|
1304
|
+
lines.append(f"{empty} {sl}")
|
|
1305
|
+
lines.append(bot_b)
|
|
1306
|
+
elif pos_name == "bottom":
|
|
1307
|
+
lines.extend([top_b, empty, title, sub, stats, empty, bot_b])
|
|
1308
|
+
for sl in spiders["bottom"]:
|
|
1309
|
+
lines.append(sl)
|
|
1310
|
+
else: # left
|
|
1311
|
+
lines.append(top_b)
|
|
1312
|
+
for i, sl in enumerate(spiders["left"]):
|
|
1313
|
+
if i == 1:
|
|
1314
|
+
lines.append(f"{sl} [{R}]║[/]{' ' * lpad}[{R}]C[/][{B}]o[/][{R}]d[/][{B}]e[/] [{R}]G[/][{B}]P[/][{R}]T[/] [{D}]v2.0[/]{' ' * (rpad + 16)}[{R}]║[/]")
|
|
1315
|
+
else:
|
|
1316
|
+
lines.append(f"{' ' * 5} {empty}")
|
|
1317
|
+
lines.extend([sub, stats, empty, bot_b])
|
|
1318
|
+
|
|
1319
|
+
return "\n".join(lines)
|
|
1320
|
+
|
|
1321
|
+
# Animate spider crawling — 1 full lap, ~2 seconds
|
|
1322
|
+
positions = ["top", "right", "bottom", "left"]
|
|
1323
|
+
try:
|
|
1324
|
+
with Live(
|
|
1325
|
+
Text.from_markup(build_banner("top")),
|
|
1326
|
+
console=console, refresh_per_second=4, transient=True,
|
|
1327
|
+
) as live:
|
|
1328
|
+
for lap in range(2):
|
|
1329
|
+
for pos in positions:
|
|
1330
|
+
live.update(Text.from_markup(build_banner(pos)))
|
|
1331
|
+
time.sleep(0.4)
|
|
1332
|
+
|
|
1333
|
+
# Final position
|
|
1334
|
+
import random
|
|
1335
|
+
final = random.choice(positions)
|
|
1336
|
+
console.print(Text.from_markup(build_banner(final)))
|
|
1337
|
+
except Exception:
|
|
1338
|
+
console.print(Text.from_markup(build_banner("top")))
|
|
1248
1339
|
console.print()
|
|
1249
1340
|
console.print(Text.from_markup(
|
|
1250
1341
|
f" [dim]model[/] [bright_blue]{model}[/]\n"
|