@duanz/pi-d-live 1.1.4 → 1.1.6

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/index.ts +6 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -144,7 +144,6 @@ function taskOf(ctx: any): string {
144
144
  return "";
145
145
  }
146
146
  }
147
- }
148
147
 
149
148
  // 工具名 → 人话。不调模型,零延迟。
150
149
  const TOOL_LABEL: Record<string, string> = {
@@ -781,7 +780,12 @@ function rewrite(s: Sess, sid: string, text: string) {
781
780
  if (lines.length) {
782
781
  // 一条播报只放一句能塞进一行的:太长的按标点切成两句,免得手机上前端被迫缩字换行
783
782
  const capped: string[] = [];
784
- for (const line of lines) for (const piece of splitLong(line)) capped.push(piece);
783
+ for (const line of lines)
784
+ for (const piece of splitLong(line)) {
785
+ // 切句切出来的碎渣(比如单独一个 emoji 加句号)并回上一句,别让它自己占一行
786
+ if (piece.length < 6 && capped.length) capped[capped.length - 1] += piece;
787
+ else capped.push(piece);
788
+ }
785
789
  emit({ kind: "lines", sid, lines: capped });
786
790
  s.history = s.history.concat(capped).slice(-8);
787
791
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duanz/pi-d-live",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "把模型思考与工具调用实时改写成内心独白,推到 pi-web 界面顶部浮层",
5
5
  "type": "module",
6
6
  "keywords": [