mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 19:01:44 +00:00
fix(regression): restore feishu cold-runtime chunking
This commit is contained in:
@@ -26,6 +26,7 @@ import type { ChannelMeta, ChannelPlugin, ClawdbotConfig } from "../runtime-api.
|
||||
import {
|
||||
buildChannelConfigSchema,
|
||||
buildProbeChannelStatusSummary,
|
||||
chunkTextForOutbound,
|
||||
createActionGate,
|
||||
createDefaultChannelRuntimeState,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
@@ -1053,7 +1054,7 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
|
||||
},
|
||||
outbound: {
|
||||
deliveryMode: "direct",
|
||||
chunker: (text, limit) => getFeishuRuntime().channel.text.chunkMarkdownText(text, limit),
|
||||
chunker: chunkTextForOutbound,
|
||||
chunkerMode: "markdown",
|
||||
textChunkLimit: 4000,
|
||||
...createRuntimeOutboundDelegates({
|
||||
|
||||
@@ -53,6 +53,16 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {
|
||||
resetOutboundMocks();
|
||||
});
|
||||
|
||||
it("chunks outbound text without requiring Feishu runtime initialization", () => {
|
||||
const chunker = feishuOutbound.chunker;
|
||||
if (!chunker) {
|
||||
throw new Error("feishuOutbound.chunker missing");
|
||||
}
|
||||
|
||||
expect(() => chunker("hello world", 5)).not.toThrow();
|
||||
expect(chunker("hello world", 5)).toEqual(["hello", "world"]);
|
||||
});
|
||||
|
||||
async function createTmpImage(ext = ".png"): Promise<{ dir: string; file: string }> {
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-feishu-outbound-"));
|
||||
const file = path.join(dir, `sample${ext}`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
||||
import type { ChannelOutboundAdapter } from "../runtime-api.js";
|
||||
import { chunkTextForOutbound, type ChannelOutboundAdapter } from "../runtime-api.js";
|
||||
import { resolveFeishuAccount } from "./accounts.js";
|
||||
import { sendMediaFeishu } from "./media.js";
|
||||
import { getFeishuRuntime } from "./runtime.js";
|
||||
@@ -79,7 +79,7 @@ async function sendOutboundText(params: {
|
||||
|
||||
export const feishuOutbound: ChannelOutboundAdapter = {
|
||||
deliveryMode: "direct",
|
||||
chunker: (text, limit) => getFeishuRuntime().channel.text.chunkMarkdownText(text, limit),
|
||||
chunker: chunkTextForOutbound,
|
||||
chunkerMode: "markdown",
|
||||
textChunkLimit: 4000,
|
||||
...createAttachedChannelResultAdapter({
|
||||
|
||||
@@ -13,6 +13,7 @@ export { logTypingFailure } from "../channels/logging.js";
|
||||
export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js";
|
||||
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
||||
export { createActionGate } from "../agents/tools/common.js";
|
||||
export { chunkTextForOutbound } from "./text-chunking.js";
|
||||
export {
|
||||
buildSingleChannelSecretPromptState,
|
||||
addWildcardAllowFrom,
|
||||
|
||||
Reference in New Issue
Block a user