shenxiang-ai-cli 0.5.6 → 0.5.7

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2217,7 +2217,7 @@ function showBanner() {
2217
2217
  console.clear();
2218
2218
  const p = chalk3.hex("#A78BFA");
2219
2219
  const w = chalk3.white;
2220
- const version = "v0.5.6";
2220
+ const version = "v0.5.7";
2221
2221
  const avatarLines = [
2222
2222
  ` ${p("\u2584\u2580\u2580\u2580\u2584")}`,
2223
2223
  ` ${p("\u2588")} ${w("\u2580")} ${w("\u2580")} ${p("\u2588")}`,
@@ -2268,11 +2268,16 @@ function showBanner() {
2268
2268
  ...wrappedQuote.map((l) => theme.dim(l)),
2269
2269
  ""
2270
2270
  ];
2271
+ const getVisualWidth = (str) => {
2272
+ return stripAnsi(str).split("").reduce((width, char) => {
2273
+ return width + (char.codePointAt(0) > 255 ? 2 : 1);
2274
+ }, 0);
2275
+ };
2271
2276
  const maxLines = Math.max(leftContent.length, rightContent.length);
2272
2277
  const lines = [];
2273
2278
  for (let i = 0; i < maxLines; i++) {
2274
2279
  const left = leftContent[i] || "";
2275
- const leftVisible = stripAnsi(left).length;
2280
+ const leftVisible = getVisualWidth(left);
2276
2281
  const leftPadding = " ".repeat(Math.max(0, leftColWidth - leftVisible));
2277
2282
  const right = rightContent[i] || "";
2278
2283
  lines.push(`${left}${leftPadding} ${theme.dim("\u2502")} ${right}`);
@@ -3387,7 +3392,7 @@ function fmtTokens3(n) {
3387
3392
  var program = new Command();
3388
3393
  var config2 = getConfig();
3389
3394
  setLocale(config2.locale);
3390
- program.name("sxai").description(t("description")).version("0.5.6");
3395
+ program.name("sxai").description(t("description")).version("0.5.7");
3391
3396
  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) => {
3392
3397
  if (options.model && options.model !== config2.model) {
3393
3398
  setConfig("model", options.model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shenxiang-ai-cli",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "沈翔的AI助手 - 终端里的AI全栈开发搭档",
5
5
  "type": "module",
6
6
  "bin": {