blun-king-cli 2.9.0 → 2.9.1
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/bin/blun.js +16 -3
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -520,13 +520,23 @@ async function handleCommand(input) {
|
|
|
520
520
|
async function sendChat(message) {
|
|
521
521
|
try {
|
|
522
522
|
printUserMessage(message);
|
|
523
|
-
// Animated thinking
|
|
523
|
+
// Animated thinking + keep input box visible
|
|
524
524
|
var dots = 0;
|
|
525
525
|
var thinkFrames = ["thinking", "thinking.", "thinking..", "thinking..."];
|
|
526
|
+
console.log(""); // line for thinking text
|
|
526
527
|
var thinkTimer = setInterval(function() {
|
|
527
|
-
process.stdout.write("\
|
|
528
|
+
process.stdout.write("\x1b[s"); // save cursor
|
|
529
|
+
// Move to thinking line (above the UI)
|
|
530
|
+
if (uiStartRow > 0) process.stdout.write("\x1b[" + (uiStartRow + 1) + "A");
|
|
531
|
+
process.stdout.write("\r\x1b[2K" + C.dim + " " + BOX.bot + " " + thinkFrames[dots % 4] + " " + C.reset);
|
|
532
|
+
process.stdout.write("\x1b[u"); // restore cursor
|
|
528
533
|
dots++;
|
|
529
534
|
}, 300);
|
|
535
|
+
// Redraw input box below thinking line
|
|
536
|
+
processing = false;
|
|
537
|
+
uiStartRow = -1;
|
|
538
|
+
drawPrompt();
|
|
539
|
+
processing = true;
|
|
530
540
|
|
|
531
541
|
var resp = await apiCall("POST", "/chat", {
|
|
532
542
|
message: message,
|
|
@@ -534,7 +544,10 @@ async function sendChat(message) {
|
|
|
534
544
|
});
|
|
535
545
|
|
|
536
546
|
clearInterval(thinkTimer);
|
|
537
|
-
|
|
547
|
+
// Erase UI before printing answer
|
|
548
|
+
eraseUI();
|
|
549
|
+
// Clear thinking line
|
|
550
|
+
process.stdout.write("\x1b[1A\r\x1b[2K");
|
|
538
551
|
|
|
539
552
|
if (resp.status !== 200) {
|
|
540
553
|
printError(resp.data.error || "API Error " + resp.status);
|