Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(bot): turn the processing placeholder message off by default, with a toggle on every platform (#21981)

Lobehub Coder1e4ae8688d2a
diff --git a/apps/cli/src/commands/bot.test.ts b/apps/cli/src/commands/bot.test.ts
index de48733e63b..e4c58ea03db 100644
--- a/apps/cli/src/commands/bot.test.ts
+++ b/apps/cli/src/commands/bot.test.ts
@@ -338,6 +338,26 @@ describe('bot command', () => {
});
});
+ it('turns the processing message off without touching other settings', async () => {
+ mockExistingBot({ botToken: BOT_CREDENTIAL_MASK, publicKey: 'public-key' });
+
+ const program = createProgram();
+ await program.parseAsync([
+ 'node',
+ 'test',
+ 'bot',
+ 'update',
+ 'b1',
+ '--processing-message',
+ 'off',
+ ]);
+
+ expect(mockTrpcClient.agentBotProvider.update.mutate).toHaveBeenCalledWith({
+ id: 'b1',
+ settings: { processingMessage: false },
+ });
+ });
+
it('does not carry credentials from the old platform when changing platform', async () => {
mockExistingBot({ botToken: BOT_CREDENTIAL_MASK, publicKey: 'discord-public-key' });
diff --git a/apps/cli/src/commands/bot.ts b/apps/cli/src/commands/bot.ts
index b7f609cc0e7..0c4ee6d2461 100644
--- a/apps/cli/src/commands/bot.ts
+++ b/apps/cli/src/commands/bot.ts
@@ -753,6 +753,10 @@ export function registerBotCommand(program: Command) {
"Owner's platform user ID (required for --dm-policy=pairing; auto-trusts the operator in the global allowlist)",
)
.option('--server-id <id>', 'Default server / guild / workspace ID for AI tool calls')
+ .option(
+ '--processing-message <on|off>',
+ 'Post a "working on it" message before each reply (off by default)',
+ )
.action(
async (
botId: string,
@@ -765,6 +769,7 @@ export function registerBotCommand(program: Command) {
encryptKey?: string;
groupPolicy?: string;
platform?: string;
+ processingMessage?: string;
publicKey?: string;
secretToken?: string;
serverId?: string;
@@ -817,6 +822,16 @@ export function registerBotCommand(program: Command) {
}
if (options.userId !== undefined) settingsPatch.userId = options.userId;
if (options.serverId !== undefined) settingsPatch.serverId = options.serverId;
+ if (options.processingMessage !== undefined) {
+ if (options.processingMessage !== 'on' && options.processingMessage !== 'off') {
+ log.error(
+ `Invalid --processing-message "${options.processingMessage}". Must be one of: on, off`,
+ );
+ process.exit(1);
+ return;
+ }
+ settingsPatch.processingMessage = options.processingMessage === 'on';
+ }
if (Object.keys(settingsPatch).length > 0) {
input.settings = {
diff --git a/apps/server/src/services/bot/AgentBridgeService/execute.ts b/apps/server/src/services/bot/AgentBridgeService/execute.ts
index fd0c49bfd83..c6549b4d3be 100644
--- a/apps/server/src/services/bot/AgentBridgeService/execute.ts
+++ b/apps/server/src/services/bot/AgentBridgeService/execute.ts
@@ -14,7 +14,7 @@ import { isQueueAgentRuntimeEnabled } from '@/server/services/queue/impls';
import { buildBotSender, formatPrompt as formatPromptUtil } from '../formatPrompt';
import type { BotReactionMode, BotReplyLocale, PlatformClient } from '../platforms';
-import { platformFromThreadId, platformRegistry } from '../platforms';
+import { platformFromThreadId, platformRegistry, shouldPostProcessingMessage } from '../platforms';
import { resolveUnsupportedMessageApis } from '../platforms/messageCapabilities';
import { buildRecentChannelHistory } from '../recentChannelHistory';
import { renderStart } from '../replyTemplate';
@@ -123,6 +123,7 @@ export async function executeWithCallback(
// `progressMessage` so downstream hooks post the final reply fresh instead
// of editing the placeholder.
const supportsMessageEdit = platformDef?.supportsMessageEdit !== false;
+ const postProcessingMessage = shouldPostProcessingMessage(opts.botSettings);
const {
agentId,
@@ -267,6 +268,10 @@ export async function executeWithCallback(
log('executeWithWebhooks: gateway provider lookup failed: %O', err);
}
}
+ } else if (!postProcessingMessage) {
+ // The "working on it" message is off (the default): typing only. With no
+ // `progressMessage`, the hooks post the final reply as its own message.
+ await safeSideEffect(() => thread.startTyping(), 'startTyping (executeWithWebhooks)');
} else if (!supportsMessageEdit) {
// Edit-incapable platform (QQ today): the user still wants immediate
// feedback that we received their message, but every "edit" the
diff --git a/apps/server/src/services/bot/AgentBridgeService/index.followUp.test.ts b/apps/server/src/services/bot/AgentBridgeService/index.followUp.test.ts
index e33de7b3f75..7f359e5466c 100644
--- a/apps/server/src/services/bot/AgentBridgeService/index.followUp.test.ts
+++ b/apps/server/src/services/bot/AgentBridgeService/index.followUp.test.ts
@@ -396,6 +396,7 @@ describe('AgentBridgeService', () => {
await service.handleMention(thread, createMessage(), {
agentId: 'agent-1',
botContext: { platformThreadId: THREAD_ID } as any,
+ botSettings: { processingMessage: true },
client: createClient(),
});
@@ -413,6 +414,7 @@ describe('AgentBridgeService', () => {
await service.handleMention(thread, createMessage(), {
agentId: 'agent-1',
botContext: { platformThreadId: THREAD_ID } as any,
+ botSettings: { processingMessage: true },
client: createClient(),
});
diff --git a/apps/server/src/services/bot/AgentBridgeService/index.localMode.test.ts b/apps/server/src/services/bot/AgentBridgeService/index.localMode.test.ts
index 769e90cd9ab..0b3f038ec3e 100644
--- a/apps/server/src/services/bot/AgentBridgeService/index.localMode.test.ts
+++ b/apps/server/src/services/bot/AgentBridgeService/index.localMode.test.ts
@@ -150,6 +150,7 @@ const mention = async (
await service.handleMention(thread, createMessage(), {
agentId: 'agent-1',
botContext: { platformThreadId: THREAD_ID } as any,
+ botSettings: { processingMessage: true },
client,
replyLocale: 'en-US',
...overrides,
@@ -371,6 +372,73 @@ describe('AgentBridgeService local mode', () => {
});
});
+ describe('with the processing message off (the default)', () => {
+ const noPlaceholder = { botSettings: {} };
+
+ it('posts the stopped notice on reason=interrupted', async () => {
+ runHooks({ onComplete: { reason: 'interrupted' } });
+ const { edit, thread } = createThread();
+
+ await mention(thread, noPlaceholder);
+
+ expect(edit).not.toHaveBeenCalled();
+ expect(thread.post).toHaveBeenCalledTimes(1);
+ expect(thread.post).toHaveBeenCalledWith({ markdown: renderStopped(undefined, 'en-US') });
+ });
+
+ it('posts the startup error when execAgent fails without a terminal report', async () => {
+ mockExecAgent.mockResolvedValue(okResult({ error: 'DEVICE_NOT_FOUND', success: false }));
+ const { edit, thread } = createThread();
+
+ await mention(thread, noPlaceholder);
+
+ expect(edit).not.toHaveBeenCalled();
+ expect(thread.post).toHaveBeenCalledTimes(1);
+ expect(thread.post).toHaveBeenCalledWith({
+ markdown: renderThrownAgentError('DEVICE_NOT_FOUND', 'op-1', 'en-US'),
+ });
+ });
+
+ it('posts nothing extra when the terminal lifecycle already reported the failure', async () => {
+ mockExecAgent.mockResolvedValue(
+ okResult({ error: 'DEVICE_NOT_FOUND', success: false, terminalReported: true }),
+ );
+ const { thread } = createThread();
+
+ await mention(thread, noPlaceholder);
+
+ expect(thread.post).not.toHaveBeenCalled();
+ });
+
+ it('posts the stopped notice when startup is aborted', async () => {
+ const abortError = new Error('Execution stopped before startup.');
+ abortError.name = 'AbortError';
+ mockExecAgent.mockRejectedValue(abortError);
+ const { edit, thread } = createThread();
+
+ await mention(thread, noPlaceholder);
+
+ expect(edit).not.toHaveBeenCalled();
+ expect(thread.post).toHaveBeenCalledWith({
+ markdown: renderStopped('Execution stopped before startup.', 'en-US'),
+ });
+ });
+
+ it('posts a generic startup rejection as its own message', async () => {
+ const error = new Error('network down');
+ mockExecAgent.mockRejectedValue(error);
+ const { edit, thread } = createThread();
+
+ await mention(thread, noPlaceholder);
+
+ expect(edit).not.toHaveBeenCalled();
+ expect(thread.post).toHaveBeenCalledTimes(1);
+ expect(thread.post).toHaveBeenCalledWith({
+ markdown: renderThrownAgentError(error, undefined, 'en-US'),
+ });
+ });
+ });
+
it('interrupts the operation once known when /stop arrived during startup', async () => {
mockExecAgent.mockImplementation(async () => {
AgentBridgeService.requestStop(THREAD_ID);
@@ -383,6 +451,7 @@ describe('AgentBridgeService local mode', () => {
const pending = service.handleMention(thread, createMessage(), {
agentId: 'agent-1',
botContext: { platformThreadId: THREAD_ID } as any,
+ botSettings: { processingMessage: true },
client: createClient().client,
});
await vi.waitFor(() => expect(mockInterruptTask).toHaveBeenCalledWith({ operationId: 'op-1' }));
diff --git a/apps/server/src/services/bot/AgentBridgeService/index.noReply.test.ts b/apps/server/src/services/bot/AgentBridgeService/index.noReply.test.ts
index b301546d635..ebd008604a5 100644
--- a/apps/server/src/services/bot/AgentBridgeService/index.noReply.test.ts
+++ b/apps/server/src/services/bot/AgentBridgeService/index.noReply.test.ts
@@ -143,6 +143,7 @@ const subscribed = async (
new AgentBridgeService(FAKE_DB, USER_ID).handleSubscribedMessage(thread, userMessage, {
agentId: 'agent-1',
botContext,
+ botSettings: { processingMessage: true },
client,
replyLocale: 'en-US',
...extra,
@@ -153,6 +154,7 @@ const fresh = async (thread: any, client: any, extra: Record<string, unknown> =
new AgentBridgeService(FAKE_DB, USER_ID).handleMention(thread, message(), {
agentId: 'agent-1',
botContext,
+ botSettings: { processingMessage: true },
client,
replyLocale: 'en-US',
...extra,
@@ -430,7 +432,7 @@ describe('AgentBridgeService no_reply and deferred follow-up feedback', () => {
});
const { progress, thread } = createThread();
const { client } = createClient();
- const botSettings = { botWake: { enabled: true } };
+ const botSettings = { botWake: { enabled: true }, processingMessage: true };
await subscribed(thread, client, { botSettings, standDown: true });
diff --git a/apps/server/src/services/bot/AgentBridgeService/index.test.ts b/apps/server/src/services/bot/AgentBridgeService/index.test.ts
index 19c8dfef126..2ca2e3914d0 100644
--- a/apps/server/src/services/bot/AgentBridgeService/index.test.ts
+++ b/apps/server/src/services/bot/AgentBridgeService/index.test.ts
@@ -605,6 +605,7 @@ describe('AgentBridgeService', () => {
await service.handleMention(thread, message, {
agentId: 'agent-1',
botContext: { platform: 'qq', platformThreadId: 'qq:c2c:user-1' } as any,
+ botSettings: { processingMessage: true },
client,
});
@@ -626,6 +627,7 @@ describe('AgentBridgeService', () => {
await service.handleMention(thread, message, {
agentId: 'agent-1',
botContext: { platform: 'discord', platformThreadId: THREAD_ID } as any,
+ botSettings: { processingMessage: true },
client,
});
@@ -633,6 +635,69 @@ describe('AgentBridgeService', () => {
// Tracked → downstream hooks will edit this message in place.
expect(progressMessageIdFromHooks()).toBe('progress-msg-1');
});
+
+ it('skips the ack on an edit-incapable platform when processingMessage is off', async () => {
+ mockGetPlatform.mockReturnValue({ id: 'qq', name: 'QQ', supportsMessageEdit: false });
+ const service = new AgentBridgeService(FAKE_DB, USER_ID);
+ const thread = createThread();
+
+ await service.handleMention(thread, createMessage(), {
+ agentId: 'agent-1',
+ botContext: { platform: 'qq', platformThreadId: 'qq:c2c:user-1' } as any,
+ botSettings: { processingMessage: false },
+ client: createClient(),
+ });
+
+ expect(thread.post).not.toHaveBeenCalled();
+ expect(thread.startTyping).toHaveBeenCalled();
+ expect(progressMessageIdFromHooks()).toBeUndefined();
+ });
+
+ it('skips the ack and posts the reply fresh on an editable platform when processingMessage is off', async () => {
+ const service = new AgentBridgeService(FAKE_DB, USER_ID);
+ const thread = createThread();
+
+ await service.handleMention(thread, createMessage(), {
+ agentId: 'agent-1',
+ botContext: { platform: 'discord', platformThreadId: THREAD_ID } as any,
+ botSettings: { processingMessage: false },
+ client: createClient(),
+ });
+
+ expect(thread.post).not.toHaveBeenCalled();
+ expect(progressMessageIdFromHooks()).toBeUndefined();
+ });
+
+ it('skips the ack by default when the bot has never set processingMessage', async () => {
+ mockGetPlatform.mockReturnValue({ id: 'qq', name: 'QQ', supportsMessageEdit: false });
+ const service = new AgentBridgeService(FAKE_DB, USER_ID);
+ const thread = createThread();
+
+ await service.handleMention(thread, createMessage(), {
+ agentId: 'agent-1',
+ botContext: { platform: 'qq', platformThreadId: 'qq:c2c:user-1' } as any,
+ client: createClient(),
+ });
+
+ expect(thread.post).not.toHaveBeenCalled();
+ expect(thread.startTyping).toHaveBeenCalled();
+ expect(progressMessageIdFromHooks()).toBeUndefined();
+ });
+
+ it('keeps the ack when processingMessage is on', async () => {
+ mockGetPlatform.mockReturnValue({ id: 'qq', name: 'QQ', supportsMessageEdit: false });
+ const service = new AgentBridgeService(FAKE_DB, USER_ID);
+ const thread = createThread();
+
+ await service.handleMention(thread, createMessage(), {
+ agentId: 'agent-1',
+ botContext: { platform: 'qq', platformThreadId: 'qq:c2c:user-1' } as any,
+ botSettings: { processingMessage: true },
+ client: createClient(),
+ });
+
+ expect(thread.post).toHaveBeenCalledTimes(1);
+ });
});
describe('activeThreads cleanup on side-effect failure', () => {
diff --git a/apps/server/src/services/bot/AgentBridgeService/localMode.ts b/apps/server/src/services/bot/AgentBridgeService/localMode.ts
index 492da536ee9..2ff6b43908a 100644
--- a/apps/server/src/services/bot/AgentBridgeService/localMode.ts
+++ b/apps/server/src/services/bot/AgentBridgeService/localMode.ts
@@ -125,6 +125,21 @@ export async function executeWithHooksLocalMode(
// last streamed progress frame.
let lastProgressText: string | undefined;
+ // Edit the placeholder when there is one; otherwise post the notice as its
+ // own message. The placeholder is off by default (`processingMessage`), so a
+ // stop or startup failure must not depend on it or the user sees nothing.
+ const showNotice = async (markdown: string, what: string) => {
+ try {
+ if (progressMessage) {
+ await progressMessage.edit({ markdown });
+ } else {
+ await thread.post({ markdown });
+ }
+ } catch (error) {
+ log('executeWithCallback[local]: failed to show %s: %O', what, error);
+ }
+ };
+
const stopGatewayTyping = () => {
if (gatewayConnectionId && botContext?.platformThreadId) {
const gwClient = getMessageGatewayClient(platformFromThreadId(botContext.platformThreadId));
@@ -280,15 +295,7 @@ export async function executeWithHooksLocalMode(
}
if (reason === 'interrupted') {
- if (progressMessage) {
- try {
- await progressMessage.edit({
- markdown: renderStopped(undefined, replyLocale),
- });
- } catch {
- // ignore edit failure
- }
- }
+ await showNotice(renderStopped(undefined, replyLocale), 'stopped message');
resolve({ reply: '', topicId: resolvedTopicId });
return;
}
@@ -512,14 +519,11 @@ export async function executeWithHooksLocalMode(
// progress message. Rendering here too would just overwrite its
// (better-classified) copy — or, with no placeholder to edit, add a
// second error message to the thread.
- if (progressMessage && !result.terminalReported) {
- try {
- await progressMessage.edit({
- markdown: renderThrownAgentError(result.error, result.operationId, replyLocale),
- });
- } catch (error) {
- log('executeWithCallback[local]: failed to edit startup error: %O', error);
- }
+ if (!result.terminalReported) {
+ await showNotice(
+ renderThrownAgentError(result.error, result.operationId, replyLocale),
+ 'startup error',
+ );
}
resolve({ reply: '', topicId: result.topicId });
@@ -552,15 +556,7 @@ export async function executeWithHooksLocalMode(
clearTimeout(timeout);
if (isAbortError(error)) {
- if (progressMessage) {
- try {
- await progressMessage.edit({
- markdown: renderStopped(error.message, replyLocale),
- });
- } catch (editError) {
- log('executeWithCallback[local]: failed to edit stopped message: %O', editError);
- }
- }
+ await showNotice(renderStopped(error.message, replyLocale), 'stopped message');
resolve({ reply: '', topicId: topicId ?? '' });
return;
@@ -589,15 +585,10 @@ export async function executeWithHooksLocalMode(
// is traceable instead of opaque.
const fallbackOperationId = deps.activeOperations.get(thread.id);
- if (progressMessage) {
- try {
- await progressMessage.edit({
- markdown: renderThrownAgentError(error, fallbackOperationId, replyLocale),
- });
- } catch (editError) {
- log('executeWithCallback[local]: failed to edit startup error: %O', editError);
- }
- }
+ await showNotice(
+ renderThrownAgentError(error, fallbackOperationId, replyLocale),
+ 'startup error',
+ );
resolve({ reply: '', topicId: topicId ?? '' });
});
diff --git a/apps/server/src/services/bot/platforms/const.ts b/apps/server/src/services/bot/platforms/const.ts
index 1a4cae4e8e8..85ef15db329 100644
--- a/apps/server/src/services/bot/platforms/const.ts
+++ b/apps/server/src/services/bot/platforms/const.ts
@@ -11,6 +11,24 @@ export const displayToolCallsField: FieldSchema = {
type: 'boolean',
};
+/**
+ * Whether the bot posts a short "working on it" message before the agent starts. Off by default:
+ * on platforms that cannot edit a sent message (QQ, WeChat) it stays in the chat as its own
+ * message, which breaks immersion for role-play bots. On editable platforms the same message is
+ * where tool-call progress is edited in, so `displayToolCalls` needs it on.
+ */
+export const processingMessageField: FieldSchema = {
+ key: 'processingMessage',
+ default: false,
+ description: 'channel.processingMessageHint',
+ label: 'channel.processingMessage',
+ type: 'boolean',
+};
+
+/** Only an explicit `true` posts the message; rows saved before the field existed skip it. */
+export const shouldPostProcessingMessage = (settings?: Record<string, unknown>): boolean =>
+ settings?.processingMessage === true;
+
/**
* Per-platform "how to find this ID" tooltip keys. Each platform paints a
* different path to the value the operator has to paste — Discord wants
diff --git a/apps/server/src/services/bot/platforms/discord/schema.ts b/apps/server/src/services/bot/platforms/discord/schema.ts
index 6dac6df1ca2..0626c66f972 100644
--- a/apps/server/src/services/bot/platforms/discord/schema.ts
+++ b/apps/server/src/services/bot/platforms/discord/schema.ts
@@ -13,6 +13,7 @@ import {
makeGroupPolicyFields,
makeServerIdField,
makeUserIdField,
+ processingMessageField,
reactionModeField,
replyPlacementField,
watchKeywordsField,
@@ -118,6 +119,7 @@ export const schema: FieldSchema[] = [
},
replyPlacementField,
displayToolCallsField,
+ processingMessageField,
reactionModeField,
{
key: 'historyLimit',
diff --git a/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts b/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts
index 8e6f1a116d7..8ea82f2e8e8 100644
--- a/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts
+++ b/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts
@@ -12,6 +12,7 @@ import {
makeDmPolicyField,
makeGroupPolicyFields,
makeUserIdField,
+ processingMessageField,
reactionModeField,
watchKeywordsField,
} from '../../const';
@@ -112,6 +113,7 @@ export const sharedSchema: FieldSchema[] = [
type: 'boolean',
},
displayToolCallsField,
+ processingMessageField,
reactionModeField,
{
key: 'historyLimit',
diff --git a/apps/server/src/services/bot/platforms/imessage/schema.ts b/apps/server/src/services/bot/platforms/imessage/schema.ts
index 06b233bff4c..9d09e98c5d7 100644
--- a/apps/server/src/services/bot/platforms/imessage/schema.ts
+++ b/apps/server/src/services/bot/platforms/imessage/schema.ts
@@ -1,6 +1,11 @@
import { DEFAULT_BOT_DEBOUNCE_MS, MAX_BOT_DEBOUNCE_MS } from '@lobechat/const';
-import { displayToolCallsField, makeUserIdField, watchKeywordsField } from '../const';
+import {
+ displayToolCallsField,
+ makeUserIdField,
+ processingMessageField,
+ watchKeywordsField,
+} from '../const';
import { deviceAccessFields } from '../deviceAccess';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
@@ -68,6 +73,7 @@ export const schema: FieldSchema[] = [
type: 'boolean',
},
displayToolCallsField,
+ processingMessageField,
watchKeywordsField,
...replyStyleFields,
],
diff --git a/apps/server/src/services/bot/platforms/index.ts b/apps/server/src/services/bot/platforms/index.ts
index b5dc72560e1..d90f5138477 100644
--- a/apps/server/src/services/bot/platforms/index.ts
+++ b/apps/server/src/services/bot/platforms/index.ts
@@ -49,6 +49,7 @@ export {
normalizeBotReactionMode,
normalizeBotReplyLocale,
normalizeBotReplyPlacementMode,
+ processingMessageField,
reactionModeField,
RECEIVED_REACTION_EMOJI,
replyPlacementField,
@@ -57,6 +58,7 @@ export {
shouldHandleDm,
shouldHandleGroup,
shouldHandleGuest,
+ shouldPostProcessingMessage,
THINKING_REACTION_EMOJI,
type UserAllowlist,
validateAccessSettings,
diff --git a/apps/server/src/services/bot/platforms/line/schema.ts b/apps/server/src/services/bot/platforms/line/schema.ts
index 4ca06e53e97..4895ad8a983 100644
--- a/apps/server/src/services/bot/platforms/line/schema.ts
+++ b/apps/server/src/services/bot/platforms/line/schema.ts
@@ -1,6 +1,11 @@
import { DEFAULT_BOT_DEBOUNCE_MS, MAX_BOT_DEBOUNCE_MS } from '@lobechat/const';
-import { displayToolCallsField, makeUserIdField, watchKeywordsField } from '../const';
+import {
+ displayToolCallsField,
+ makeUserIdField,
+ processingMessageField,
+ watchKeywordsField,
+} from '../const';
import { deviceAccessFields } from '../deviceAccess';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
@@ -87,6 +92,7 @@ export const schema: FieldSchema[] = [
type: 'boolean',
},
displayToolCallsField,
+ processingMessageField,
watchKeywordsField,
...replyStyleFields,
],
diff --git a/apps/server/src/services/bot/platforms/processingMessage.test.ts b/apps/server/src/services/bot/platforms/processingMessage.test.ts
new file mode 100644
index 00000000000..ea0a4bfcecd
--- /dev/null
+++ b/apps/server/src/services/bot/platforms/processingMessage.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from 'vitest';
+
+import { processingMessageField, shouldPostProcessingMessage } from './const';
+import { schema as discordSchema } from './discord/schema';
+import { sharedSchema as feishuSchema } from './feishu/definitions/schema';
+import { schema as imessageSchema } from './imessage/schema';
+import { schema as lineSchema } from './line/schema';
+import { schema as qqSchema } from './qq/schema';
+import { schema as slackSchema } from './slack/schema';
+import { schema as telegramSchema } from './telegram/schema';
+import type { FieldSchema } from './types';
+import { schema as wechatSchema } from './wechat/schema';
+
+describe('shouldPostProcessingMessage', () => {
+ it('skips the message for rows saved before the field existed', () => {
+ expect(shouldPostProcessingMessage(undefined)).toBe(false);
+ expect(shouldPostProcessingMessage({})).toBe(false);
+ });
+
+ it('posts the message only on an explicit true', () => {
+ expect(shouldPostProcessingMessage({ processingMessage: true })).toBe(true);
+ expect(shouldPostProcessingMessage({ processingMessage: false })).toBe(false);
+ expect(shouldPostProcessingMessage({ processingMessage: 'true' })).toBe(false);
+ });
+});
+
+describe('processingMessageField', () => {
+ it('defaults to off', () => {
+ expect(processingMessageField.default).toBe(false);
+ });
+
+ it.each([
+ ['discord', discordSchema],
+ ['feishu', feishuSchema],
+ ['imessage', imessageSchema],
+ ['line', lineSchema],
+ ['qq', qqSchema],
+ ['slack', slackSchema],
+ ['telegram', telegramSchema],
+ ['wechat', wechatSchema],
+ ])('is exposed in the %s settings', (_platform, schema: FieldSchema[]) => {
+ const settings = schema.find((field) => field.key === 'settings');
+ expect(settings?.properties?.some((field) => field.key === 'processingMessage')).toBe(true);
+ });
+});
diff --git a/apps/server/src/services/bot/platforms/qq/schema.ts b/apps/server/src/services/bot/platforms/qq/schema.ts
index ddcdccf7054..197d2f8ceb2 100644
--- a/apps/server/src/services/bot/platforms/qq/schema.ts
+++ b/apps/server/src/services/bot/platforms/qq/schema.ts
@@ -6,6 +6,7 @@ import {
makeDmPolicyField,
makeGroupPolicyFields,
makeUserIdField,
+ processingMessageField,
watchKeywordsField,
} from '../const';
import { deviceAccessFields } from '../deviceAccess';
@@ -99,6 +100,7 @@ export const schema: FieldSchema[] = [
type: 'boolean',
},
displayToolCallsField,
+ processingMessageField,
makeDmPolicyField({ policy: 'open' }),
...makeGroupPolicyFields({ policy: 'open' }),
allowFromField,
diff --git a/apps/server/src/services/bot/platforms/slack/schema.ts b/apps/server/src/services/bot/platforms/slack/schema.ts
index 0640928b964..dc8398480dc 100644
--- a/apps/server/src/services/bot/platforms/slack/schema.ts
+++ b/apps/server/src/services/bot/platforms/slack/schema.ts
@@ -12,6 +12,7 @@ import {
makeGroupPolicyFields,
makeServerIdField,
makeUserIdField,
+ processingMessageField,
reactionModeField,
replyPlacementField,
watchKeywordsField,
@@ -123,6 +124,7 @@ export const schema: FieldSchema[] = [
},
replyPlacementField,
displayToolCallsField,
+ processingMessageField,
reactionModeField,
{
key: 'historyLimit',
diff --git a/apps/server/src/services/bot/platforms/telegram/schema.ts b/apps/server/src/services/bot/platforms/telegram/schema.ts
index 1404a1bc78b..7d1a4748313 100644
--- a/apps/server/src/services/bot/platforms/telegram/schema.ts
+++ b/apps/server/src/services/bot/platforms/telegram/schema.ts
@@ -7,6 +7,7 @@ import {
makeGroupPolicyFields,
makeGuestPolicyField,
makeUserIdField,
+ processingMessageField,
reactionModeField,
watchKeywordsField,
} from '../const';
@@ -95,6 +96,7 @@ export const schema: FieldSchema[] = [
type: 'boolean',
},
displayToolCallsField,
+ processingMessageField,
reactionModeField,
makeDmPolicyField({ policy: 'open' }),
makeGuestPolicyField({ policy: 'open' }),
diff --git a/apps/server/src/services/bot/platforms/wechat/schema.ts b/apps/server/src/services/bot/platforms/wechat/schema.ts
index 159c58ded8a..51bb4682e42 100644
--- a/apps/server/src/services/bot/platforms/wechat/schema.ts
+++ b/apps/server/src/services/bot/platforms/wechat/schema.ts
@@ -1,6 +1,6 @@
import { DEFAULT_BOT_DEBOUNCE_MS, MAX_BOT_DEBOUNCE_MS } from '@lobechat/const';
-import { displayToolCallsField, watchKeywordsField } from '../const';
+import { displayToolCallsField, processingMessageField, watchKeywordsField } from '../const';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
@@ -55,6 +55,7 @@ export const schema: FieldSchema[] = [
type: 'boolean',
},
displayToolCallsField,
+ processingMessageField,
watchKeywordsField,
...replyStyleFields,
],
diff --git a/locales/en-US/agent.json b/locales/en-US/agent.json
index 6b02fb78eaa..f6a0d98063e 100644
--- a/locales/en-US/agent.json
+++ b/locales/en-US/agent.json
@@ -347,6 +347,8 @@
"channel.platform.wechat.description": "Make the agent available in everyday chats—ideal for personal assistance and WeChat-based audiences.",
"channel.platform.whatsapp.description": "Meet customers in familiar mobile chats for support and follow-ups—ideal for customer-facing teams.",
"channel.platforms": "Platforms",
+ "channel.processingMessage": "Processing Message",
+ "channel.processingMessageHint": "Post a short message saying the bot is working on it before the reply. Where messages can be edited, tool call progress also shows in this message.",
"channel.publicKey": "Public Key",
"channel.publicKeyHint": "Used to verify interaction requests from Discord. A 64-character hex string on your app's General Information page.",
"channel.publicKeyInvalid": "Public Key must be a 64-character hex string. Copy it from the Discord app's General Information page — not the OAuth URL, and not an API key.",
diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.json
index 7bd73373f3f..1f37845f201 100644
--- a/locales/zh-CN/agent.json
+++ b/locales/zh-CN/agent.json
@@ -347,6 +347,8 @@
"channel.platform.wechat.description": "让智能体进入日常微信聊天,适合个人助理和主要使用微信的用户群体。",
"channel.platform.whatsapp.description": "在熟悉的移动聊天中提供支持和跟进,适合直接服务客户的团队。",
"channel.platforms": "平台",
+ "channel.processingMessage": "「处理中」提示",
+ "channel.processingMessageHint": "回复前先发送一条「正在处理」的提示消息。在支持编辑消息的平台上,工具调用进度也会显示在这条消息里。",
"channel.publicKey": "公钥",
"channel.publicKeyHint": "用于验证来自 Discord 的交互请求。为应用 General Information 页面上的 64 位十六进制字符串。",
"channel.publicKeyInvalid": "公钥必须是 64 位十六进制字符串。请从 Discord 应用的 General Information 页面复制,不要填 OAuth 链接,也不要填 API Key。",
diff --git a/packages/locales/src/default/agent.ts b/packages/locales/src/default/agent.ts
index bca8e6348fb..295c09f672c 100644
--- a/packages/locales/src/default/agent.ts
+++ b/packages/locales/src/default/agent.ts
@@ -763,6 +763,9 @@ export default {
'channel.displayToolCalls': 'Display Tool Calls',
'channel.displayToolCallsHint':
'Show tool call details during AI responses. When disabled, only the final response is displayed for a cleaner experience.',
+ 'channel.processingMessage': 'Processing Message',
+ 'channel.processingMessageHint':
+ 'Post a short message saying the bot is working on it before the reply. Where messages can be edited, tool call progress also shows in this message.',
'channel.reactionMode': 'Status Reactions',
'channel.reactionModeHint':
'How the bot updates the emoji reaction on your message while it works. Every change can notify members who have message alerts enabled.',
diff --git a/src/features/AgentChannel/PlatformDetail/settingsGroups.ts b/src/features/AgentChannel/PlatformDetail/settingsGroups.ts
index 18e0bbb9e1a..b48ac85fbf4 100644
--- a/src/features/AgentChannel/PlatformDetail/settingsGroups.ts
+++ b/src/features/AgentChannel/PlatformDetail/settingsGroups.ts
@@ -65,7 +65,13 @@ export const groupAccessFields = (fields: FieldSchema[]): AccessSectionGroup[] =
};
/** What a reply looks like in the chat. These save themselves as soon as they change. */
-export const REPLY_KEYS = ['replyPlacement', 'displayToolCalls', 'showUsageStats', 'reactionMode'];
+export const REPLY_KEYS = [
+ 'replyPlacement',
+ 'displayToolCalls',
+ 'processingMessage',
+ 'showUsageStats',
+ 'reactionMode',
+];
/**
* How the bot talks: its style everywhere, a style per channel, and the emoji it may use. Long