mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 05:01:15 +00:00
fix(regression): restore whatsapp cold-runtime chunking
This commit is contained in:
@@ -119,6 +119,15 @@ async function runSeparatePhoneFlow(params: { selectValues: string[]; textValues
|
||||
}
|
||||
|
||||
describe("whatsappPlugin outbound sendMedia", () => {
|
||||
it("chunks outbound text without requiring WhatsApp runtime initialization", () => {
|
||||
const chunker = whatsappPlugin.outbound?.chunker;
|
||||
if (!chunker) {
|
||||
throw new Error("whatsapp outbound chunker is unavailable");
|
||||
}
|
||||
|
||||
expect(chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
|
||||
});
|
||||
|
||||
it("forwards mediaLocalRoots to sendMessageWhatsApp", async () => {
|
||||
const sendWhatsApp = vi.fn(async () => ({
|
||||
messageId: "msg-1",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
|
||||
import { createChatChannelPlugin } from "openclaw/plugin-sdk/core";
|
||||
import { chunkText } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import {
|
||||
createAsyncComputedAccountStatusAdapter,
|
||||
createDefaultChannelRuntimeState,
|
||||
@@ -65,7 +66,7 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> =
|
||||
},
|
||||
outbound: {
|
||||
...createWhatsAppOutboundBase({
|
||||
chunker: (text, limit) => getWhatsAppRuntime().channel.text.chunkText(text, limit),
|
||||
chunker: chunkText,
|
||||
sendMessageWhatsApp: async (...args) =>
|
||||
await getWhatsAppRuntime().channel.whatsapp.sendMessageWhatsApp(...args),
|
||||
sendPollWhatsApp: async (...args) =>
|
||||
|
||||
Reference in New Issue
Block a user