shenxiang-ai-cli 0.5.4 → 0.5.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/dist/index.js +24 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2226,7 +2226,7 @@ function showBanner() {
|
|
|
2226
2226
|
console.clear();
|
|
2227
2227
|
const p = chalk3.hex("#A78BFA");
|
|
2228
2228
|
const w = chalk3.white;
|
|
2229
|
-
const version = "v0.5.
|
|
2229
|
+
const version = "v0.5.5";
|
|
2230
2230
|
const avatarLines = [
|
|
2231
2231
|
` ${p("\u2584\u2580\u2580\u2580\u2584")}`,
|
|
2232
2232
|
` ${p("\u2588")} ${w("\u2580")} ${w("\u2580")} ${p("\u2588")}`,
|
|
@@ -2236,7 +2236,8 @@ function showBanner() {
|
|
|
2236
2236
|
];
|
|
2237
2237
|
const terminalWidth = process.stdout.columns || 80;
|
|
2238
2238
|
const boxWidth = Math.max(60, Math.min(terminalWidth - 4, 120));
|
|
2239
|
-
const leftColWidth = Math.floor(boxWidth * 0.
|
|
2239
|
+
const leftColWidth = Math.floor(boxWidth * 0.35);
|
|
2240
|
+
const rightColWidth = boxWidth - leftColWidth - 4;
|
|
2240
2241
|
const leftContent = [
|
|
2241
2242
|
"",
|
|
2242
2243
|
" Welcome back!",
|
|
@@ -2247,6 +2248,25 @@ function showBanner() {
|
|
|
2247
2248
|
` ${chalk3.dim(process.cwd().length > leftColWidth - 2 ? "..." + process.cwd().slice(-(leftColWidth - 5)) : process.cwd())}`,
|
|
2248
2249
|
""
|
|
2249
2250
|
];
|
|
2251
|
+
const wrapText = (text, width) => {
|
|
2252
|
+
const words = text.split("");
|
|
2253
|
+
const lines2 = [];
|
|
2254
|
+
let currentLine = "";
|
|
2255
|
+
for (const char of words) {
|
|
2256
|
+
const charWidth = char.codePointAt(0) > 255 ? 2 : 1;
|
|
2257
|
+
const currentLineWidth = currentLine.split("").reduce((acc, c) => acc + (c.codePointAt(0) > 255 ? 2 : 1), 0);
|
|
2258
|
+
if (currentLineWidth + charWidth > width) {
|
|
2259
|
+
lines2.push(currentLine);
|
|
2260
|
+
currentLine = char;
|
|
2261
|
+
} else {
|
|
2262
|
+
currentLine += char;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
if (currentLine) lines2.push(currentLine);
|
|
2266
|
+
return lines2;
|
|
2267
|
+
};
|
|
2268
|
+
const quote = "\u5343\u4E07\u522B\u8DDF\u8BA4\u77E5\u4E0D\u540C\u9891\u7684\u4EBA\u4E89\u8BBA\uFF0C\u66F4\u522B\u548C\u4ED6\u4EEC\u8BA1\u8F83\uFF0C\u771F\u6B63\u7684\u806A\u660E\uFF0C\u662F\u61C2\u5F97\u7B5B\u9009\uFF0C\u800C\u4E0D\u662F\u8BD5\u56FE\u6539\u53D8";
|
|
2269
|
+
const wrappedQuote = wrapText(quote, rightColWidth - 2);
|
|
2250
2270
|
const rightContent = [
|
|
2251
2271
|
theme.brand("Tips for getting started"),
|
|
2252
2272
|
`Run ${theme.code("/help")} for a list of commands`,
|
|
@@ -2254,7 +2274,7 @@ function showBanner() {
|
|
|
2254
2274
|
theme.brand("Recent activity"),
|
|
2255
2275
|
"No recent activity",
|
|
2256
2276
|
"",
|
|
2257
|
-
|
|
2277
|
+
...wrappedQuote.map((l) => theme.dim(l)),
|
|
2258
2278
|
""
|
|
2259
2279
|
];
|
|
2260
2280
|
const maxLines = Math.max(leftContent.length, rightContent.length);
|
|
@@ -3370,7 +3390,7 @@ function fmtTokens3(n) {
|
|
|
3370
3390
|
var program = new Command();
|
|
3371
3391
|
var config2 = getConfig();
|
|
3372
3392
|
setLocale(config2.locale);
|
|
3373
|
-
program.name("sxai").description(t("description")).version("0.5.
|
|
3393
|
+
program.name("sxai").description(t("description")).version("0.5.5");
|
|
3374
3394
|
program.command("chat", { isDefault: true }).description("\u542F\u52A8\u4EA4\u4E92\u5F0FAI\u5BF9\u8BDD\uFF08\u9ED8\u8BA4\u547D\u4EE4\uFF09").option("-m, --model <model>", "\u6307\u5B9AAI\u6A21\u578B", config2.model).option("-y, --yolo", "\u81EA\u52A8\u6A21\u5F0F\uFF1A\u8DF3\u8FC7\u6240\u6709\u786E\u8BA4\uFF0C\u8BA9AI\u81EA\u4E3B\u6267\u884C").action(async (options) => {
|
|
3375
3395
|
if (options.model && options.model !== config2.model) {
|
|
3376
3396
|
setConfig("model", options.model);
|