codegpt-ai 2.7.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 +77 -38
- package/package.json +1 -1
package/chat.py
CHANGED
|
@@ -1242,61 +1242,100 @@ def print_header(model):
|
|
|
1242
1242
|
B = "bold bright_blue"
|
|
1243
1243
|
D = "dim"
|
|
1244
1244
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
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}]║[/]"
|
|
1257
1288
|
|
|
1258
1289
|
lines = []
|
|
1259
|
-
p = pos % 8
|
|
1260
1290
|
|
|
1261
|
-
if
|
|
1262
|
-
|
|
1263
|
-
|
|
1291
|
+
if pos_name == "top":
|
|
1292
|
+
for sl in spiders["top"]:
|
|
1293
|
+
lines.append(sl)
|
|
1264
1294
|
lines.extend([top_b, empty, title, sub, stats, empty, bot_b])
|
|
1265
|
-
elif
|
|
1266
|
-
lines.
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
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":
|
|
1272
1307
|
lines.extend([top_b, empty, title, sub, stats, empty, bot_b])
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
else: # left
|
|
1308
|
+
for sl in spiders["bottom"]:
|
|
1309
|
+
lines.append(sl)
|
|
1310
|
+
else: # left
|
|
1276
1311
|
lines.append(top_b)
|
|
1277
|
-
|
|
1278
|
-
|
|
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}")
|
|
1279
1317
|
lines.extend([sub, stats, empty, bot_b])
|
|
1280
1318
|
|
|
1281
1319
|
return "\n".join(lines)
|
|
1282
1320
|
|
|
1283
|
-
# Animate spider crawling
|
|
1321
|
+
# Animate spider crawling — 1 full lap, ~2 seconds
|
|
1322
|
+
positions = ["top", "right", "bottom", "left"]
|
|
1284
1323
|
try:
|
|
1285
1324
|
with Live(
|
|
1286
|
-
Text.from_markup(build_banner(
|
|
1287
|
-
console=console, refresh_per_second=
|
|
1325
|
+
Text.from_markup(build_banner("top")),
|
|
1326
|
+
console=console, refresh_per_second=4, transient=True,
|
|
1288
1327
|
) as live:
|
|
1289
|
-
for
|
|
1290
|
-
|
|
1291
|
-
|
|
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)
|
|
1292
1332
|
|
|
1293
|
-
# Final position
|
|
1333
|
+
# Final position
|
|
1294
1334
|
import random
|
|
1295
|
-
final = random.
|
|
1335
|
+
final = random.choice(positions)
|
|
1296
1336
|
console.print(Text.from_markup(build_banner(final)))
|
|
1297
1337
|
except Exception:
|
|
1298
|
-
|
|
1299
|
-
console.print(Text.from_markup(build_banner(0)))
|
|
1338
|
+
console.print(Text.from_markup(build_banner("top")))
|
|
1300
1339
|
console.print()
|
|
1301
1340
|
console.print(Text.from_markup(
|
|
1302
1341
|
f" [dim]model[/] [bright_blue]{model}[/]\n"
|