blun-king-cli 7.0.3 → 7.0.4
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 +21 -0
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -73,11 +73,32 @@ function startChat() {
|
|
|
73
73
|
ui.renderPermissionLine(permissionMode);
|
|
74
74
|
console.log();
|
|
75
75
|
|
|
76
|
+
var SLASH_COMMANDS = [
|
|
77
|
+
["/help", "Show all commands"],
|
|
78
|
+
["/model", "Switch AI model"],
|
|
79
|
+
["/settings", "Show/change settings"],
|
|
80
|
+
["/perm", "Cycle permission mode (safe/normal/god)"],
|
|
81
|
+
["/status", "Token usage & uptime"],
|
|
82
|
+
["/whoami", "Current user info"],
|
|
83
|
+
["/keys", "List API keys"],
|
|
84
|
+
["/login", "Login from chat"],
|
|
85
|
+
["/clear", "Clear screen"],
|
|
86
|
+
["/exit", "Exit chat"],
|
|
87
|
+
];
|
|
88
|
+
var slashNames = SLASH_COMMANDS.map(function (c) { return c[0]; });
|
|
89
|
+
|
|
76
90
|
var rl = readline.createInterface({
|
|
77
91
|
input: process.stdin,
|
|
78
92
|
output: process.stdout,
|
|
79
93
|
prompt: ui.renderPrompt(),
|
|
80
94
|
terminal: true,
|
|
95
|
+
completer: function (line) {
|
|
96
|
+
if (line.startsWith("/")) {
|
|
97
|
+
var hits = slashNames.filter(function (c) { return c.startsWith(line); });
|
|
98
|
+
return [hits.length ? hits : slashNames, line];
|
|
99
|
+
}
|
|
100
|
+
return [[], line];
|
|
101
|
+
},
|
|
81
102
|
});
|
|
82
103
|
|
|
83
104
|
showPrompt(rl, username, model);
|