@duanz/pi-d-live 1.1.5 → 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 -1
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -780,7 +780,12 @@ function rewrite(s: Sess, sid: string, text: string) {
780
780
  if (lines.length) {
781
781
  // 一条播报只放一句能塞进一行的:太长的按标点切成两句,免得手机上前端被迫缩字换行
782
782
  const capped: string[] = [];
783
- 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
+ }
784
789
  emit({ kind: "lines", sid, lines: capped });
785
790
  s.history = s.history.concat(capped).slice(-8);
786
791
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duanz/pi-d-live",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "把模型思考与工具调用实时改写成内心独白,推到 pi-web 界面顶部浮层",
5
5
  "type": "module",
6
6
  "keywords": [