fix: update default chunk mode to 'length' for BlueBubbles
- Changed the default value of `chunkMode` from 'newline' to 'length' in the BlueBubbles configuration and related processing functions. - Updated documentation to reflect the new default behavior for chunking messages. - Adjusted tests to ensure the correct default value is returned for BlueBubbles chunk mode.
This commit is contained in:
parent
824154deba
commit
b9edeae961
@ -196,7 +196,7 @@ Provider options:
|
|||||||
- `channels.bluebubbles.sendReadReceipts`: Send read receipts (default: `true`).
|
- `channels.bluebubbles.sendReadReceipts`: Send read receipts (default: `true`).
|
||||||
- `channels.bluebubbles.blockStreaming`: Enable block streaming (default: `true`).
|
- `channels.bluebubbles.blockStreaming`: Enable block streaming (default: `true`).
|
||||||
- `channels.bluebubbles.textChunkLimit`: Outbound chunk size in chars (default: 4000).
|
- `channels.bluebubbles.textChunkLimit`: Outbound chunk size in chars (default: 4000).
|
||||||
- `channels.bluebubbles.chunkMode`: `newline` (default) splits on every newline and sends each line immediately during streaming; `length` splits only when exceeding `textChunkLimit`.
|
- `channels.bluebubbles.chunkMode`: `length` (default) splits only when exceeding `textChunkLimit`; `newline` splits on every newline and sends each line immediately during streaming.
|
||||||
- `channels.bluebubbles.mediaMaxMb`: Inbound media cap in MB (default: 8).
|
- `channels.bluebubbles.mediaMaxMb`: Inbound media cap in MB (default: 8).
|
||||||
- `channels.bluebubbles.historyLimit`: Max group messages for context (0 disables).
|
- `channels.bluebubbles.historyLimit`: Max group messages for context (0 disables).
|
||||||
- `channels.bluebubbles.dmHistoryLimit`: DM history limit.
|
- `channels.bluebubbles.dmHistoryLimit`: DM history limit.
|
||||||
|
|||||||
@ -47,7 +47,7 @@ function mergeBlueBubblesAccountConfig(
|
|||||||
};
|
};
|
||||||
const { accounts: _ignored, ...rest } = base;
|
const { accounts: _ignored, ...rest } = base;
|
||||||
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
||||||
const chunkMode = account.chunkMode ?? rest.chunkMode ?? "newline";
|
const chunkMode = account.chunkMode ?? rest.chunkMode ?? "length";
|
||||||
return { ...rest, ...account, chunkMode };
|
return { ...rest, ...account, chunkMode };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1851,7 +1851,7 @@ async function processMessage(
|
|||||||
account.config.textChunkLimit && account.config.textChunkLimit > 0
|
account.config.textChunkLimit && account.config.textChunkLimit > 0
|
||||||
? account.config.textChunkLimit
|
? account.config.textChunkLimit
|
||||||
: DEFAULT_TEXT_LIMIT;
|
: DEFAULT_TEXT_LIMIT;
|
||||||
const chunkMode = account.config.chunkMode ?? "newline";
|
const chunkMode = account.config.chunkMode ?? "length";
|
||||||
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
||||||
cfg: config,
|
cfg: config,
|
||||||
channel: "bluebubbles",
|
channel: "bluebubbles",
|
||||||
@ -1875,7 +1875,9 @@ async function processMessage(
|
|||||||
sentMessage = true;
|
sentMessage = true;
|
||||||
statusSink?.({ lastOutboundAt: Date.now() });
|
statusSink?.({ lastOutboundAt: Date.now() });
|
||||||
// In newline mode, restart typing after each chunk if more chunks remain
|
// In newline mode, restart typing after each chunk if more chunks remain
|
||||||
|
// Small delay allows the Apple API to finish clearing the typing state from message send
|
||||||
if (chunkMode === "newline" && i < chunks.length - 1 && chatGuidForActions) {
|
if (chunkMode === "newline" && i < chunks.length - 1 && chatGuidForActions) {
|
||||||
|
await new Promise((r) => setTimeout(r, 150));
|
||||||
sendBlueBubblesTyping(chatGuidForActions, true, {
|
sendBlueBubblesTyping(chatGuidForActions, true, {
|
||||||
cfg: config,
|
cfg: config,
|
||||||
accountId: account.accountId,
|
accountId: account.accountId,
|
||||||
|
|||||||
@ -296,6 +296,7 @@ describe("resolveChunkMode", () => {
|
|||||||
it("returns length as default", () => {
|
it("returns length as default", () => {
|
||||||
expect(resolveChunkMode(undefined, "telegram")).toBe("length");
|
expect(resolveChunkMode(undefined, "telegram")).toBe("length");
|
||||||
expect(resolveChunkMode({}, "discord")).toBe("length");
|
expect(resolveChunkMode({}, "discord")).toBe("length");
|
||||||
|
expect(resolveChunkMode(undefined, "bluebubbles")).toBe("length");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns length for internal channel", () => {
|
it("returns length for internal channel", () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user