blun-king-cli 7.3.3 → 7.3.5
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/lib/chat.js +33 -8
- package/lib/client.js +10 -1
- package/lib/ui.js +1 -1
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -341,7 +341,14 @@ function startChat() {
|
|
|
341
341
|
// Show thinking indicator
|
|
342
342
|
printToScrollArea(chalk.dim(" ⠋ Thinking..."));
|
|
343
343
|
|
|
344
|
-
client.sendMessage(input, {
|
|
344
|
+
client.sendMessage(input, {
|
|
345
|
+
model: settings.model || "auto",
|
|
346
|
+
latencyMode: settings.latencyMode || "fast",
|
|
347
|
+
styleMode: settings.styleMode || "normal",
|
|
348
|
+
toolMode: settings.toolMode || "smart",
|
|
349
|
+
historyWindow: settings.historyWindow || 8,
|
|
350
|
+
language: settings.language || "de",
|
|
351
|
+
})
|
|
345
352
|
.then(function (res) {
|
|
346
353
|
if (res.status === 200 && res.data) {
|
|
347
354
|
var text = res.data.answer || res.data.response || res.data.text || res.data.message || JSON.stringify(res.data);
|
|
@@ -382,7 +389,10 @@ function startChat() {
|
|
|
382
389
|
function openDropdownBelow(items, onSelect, onClose) {
|
|
383
390
|
var active = true;
|
|
384
391
|
var selected = 0;
|
|
385
|
-
var
|
|
392
|
+
var maxVisible = 10; // max visible items
|
|
393
|
+
var scrollOffset = 0;
|
|
394
|
+
var visibleCount = Math.min(items.length, maxVisible);
|
|
395
|
+
var menuHeight = visibleCount + 2; // visible items + help + padding
|
|
386
396
|
// Temporarily increase panel height to make room for menu below panel
|
|
387
397
|
var savedHeight = INPUT_PANEL_HEIGHT;
|
|
388
398
|
INPUT_PANEL_HEIGHT = 5 + menuHeight; // 5 = panel itself
|
|
@@ -400,13 +410,18 @@ function startChat() {
|
|
|
400
410
|
INPUT_PANEL_HEIGHT = savedHeight;
|
|
401
411
|
var rows = getRows();
|
|
402
412
|
// Clear the entire menu + panel area
|
|
403
|
-
for (var r = rows -
|
|
413
|
+
for (var r = rows - savedHeight - menuHeight - 2; r <= rows; r++) {
|
|
404
414
|
process.stdout.write(cursorTo(Math.max(1, r), 1) + clearLine());
|
|
405
415
|
}
|
|
406
416
|
setupLayout();
|
|
407
417
|
drawInputPanel();
|
|
408
418
|
}
|
|
409
419
|
|
|
420
|
+
function updateScroll() {
|
|
421
|
+
if (selected < scrollOffset) scrollOffset = selected;
|
|
422
|
+
if (selected >= scrollOffset + visibleCount) scrollOffset = selected - visibleCount + 1;
|
|
423
|
+
}
|
|
424
|
+
|
|
410
425
|
function drawMenu() {
|
|
411
426
|
var cols = getCols();
|
|
412
427
|
var t = ui.getTheme();
|
|
@@ -414,17 +429,27 @@ function startChat() {
|
|
|
414
429
|
|
|
415
430
|
process.stdout.write(saveCursor());
|
|
416
431
|
|
|
417
|
-
|
|
432
|
+
updateScroll();
|
|
433
|
+
for (var i = 0; i < visibleCount; i++) {
|
|
434
|
+
var idx = scrollOffset + i;
|
|
418
435
|
var row = start + i;
|
|
419
436
|
process.stdout.write(cursorTo(row, 1) + clearLine());
|
|
420
|
-
|
|
421
|
-
|
|
437
|
+
if (idx < items.length) {
|
|
438
|
+
var marker = idx === selected ? chalk.cyan(" ▸ ") : " ";
|
|
439
|
+
process.stdout.write(marker + items[idx].display);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// Scroll indicator
|
|
444
|
+
var scrollInfo = "";
|
|
445
|
+
if (items.length > visibleCount) {
|
|
446
|
+
scrollInfo = chalk.dim(" [" + (selected + 1) + "/" + items.length + "]");
|
|
422
447
|
}
|
|
423
448
|
|
|
424
449
|
// Help line
|
|
425
|
-
var helpRow = start +
|
|
450
|
+
var helpRow = start + visibleCount;
|
|
426
451
|
process.stdout.write(cursorTo(helpRow, 1) + clearLine());
|
|
427
|
-
process.stdout.write(chalk.dim(" ↑↓ select " + (items[0].help || "Enter confirm Esc close")));
|
|
452
|
+
process.stdout.write(chalk.dim(" ↑↓ select " + (items[0].help || "Enter confirm Esc close")) + scrollInfo);
|
|
428
453
|
|
|
429
454
|
process.stdout.write(restoreCursor());
|
|
430
455
|
}
|
package/lib/client.js
CHANGED
|
@@ -39,7 +39,16 @@ function request(method, urlPath, body) {
|
|
|
39
39
|
|
|
40
40
|
function sendMessage(message, options) {
|
|
41
41
|
options = options || {};
|
|
42
|
-
var body = {
|
|
42
|
+
var body = {
|
|
43
|
+
message: message,
|
|
44
|
+
model: options.model || "auto",
|
|
45
|
+
stream: false,
|
|
46
|
+
latency_mode: options.latencyMode || "fast",
|
|
47
|
+
style_mode: options.styleMode || "normal",
|
|
48
|
+
tool_mode: options.toolMode || "smart",
|
|
49
|
+
history_window: options.historyWindow || 8,
|
|
50
|
+
language: options.language || "de",
|
|
51
|
+
};
|
|
43
52
|
return request("POST", "/api/king/chat", body);
|
|
44
53
|
}
|
|
45
54
|
|
package/lib/ui.js
CHANGED
|
@@ -61,7 +61,7 @@ function setTheme(name) {
|
|
|
61
61
|
// ── Settings Fields ───────────────────────────────────────
|
|
62
62
|
var SETTINGS_FIELDS = [
|
|
63
63
|
// Core
|
|
64
|
-
{ section: "Core", key: "model", label: "Model", values: ["auto", "
|
|
64
|
+
{ section: "Core", key: "model", label: "Model", values: ["auto", "king", "queen", "prince"], help: "Welches Modell standardmaessig antwortet." },
|
|
65
65
|
{ section: "Core", key: "language", label: "Language", values: ["de", "en", "tr", "fr", "es"], help: "Primaere Antwortsprache." },
|
|
66
66
|
{ section: "Core", key: "permissionMode", label: "Permission", values: ["safe", "normal", "god"], help: "Welche Aktionen BLUN ausfuehren darf." },
|
|
67
67
|
{ section: "Core", key: "defaultMode", label: "Mode", values: ["agent", "chat"], help: "Agent-Modus oder reiner Chat." },
|