test: simplify googlechat chunk word scan · openclaw/openclaw@9557fd1
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
File tree
extensions/googlechat/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -107,10 +107,12 @@ vi.mock("./channel.deps.runtime.js", () => {
|
107 | 107 | GoogleChatConfigSchema: {}, |
108 | 108 | buildChannelConfigSchema: () => ({}), |
109 | 109 | chunkTextForOutbound: (text: string, maxChars: number) => { |
110 | | -const words = text.split(/\s+/).filter(Boolean); |
111 | 110 | const chunks: string[] = []; |
112 | 111 | let current = ""; |
113 | | -for (const word of words) { |
| 112 | +for (const word of text.split(/\s+/)) { |
| 113 | +if (!word) { |
| 114 | +continue; |
| 115 | +} |
114 | 116 | const next = current ? `${current} ${word}` : word; |
115 | 117 | if (current && next.length > maxChars) { |
116 | 118 | chunks.push(current); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。