From a5379d5fff0065d98829746199c7d35f05bb9315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=86=E6=9C=88?= <2835601846@qq.com> Date: Tue, 21 Apr 2026 18:01:16 +0800 Subject: [PATCH] feat(feishu): Add group chat trigger and random emoji response frontend configuration (#2607) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 group_trigger.mention_only 开关配置(群聊仅提及时响应) - 添加 random_reaction_emoji 数组配置(自定义表情回应列表) - 更新中英文国际化翻译 --- .../channels/channel-forms/feishu-form.tsx | 40 +++++++++++++++++++ web/frontend/src/i18n/locales/en.json | 4 ++ web/frontend/src/i18n/locales/zh.json | 4 ++ 3 files changed, 48 insertions(+) diff --git a/web/frontend/src/components/channels/channel-forms/feishu-form.tsx b/web/frontend/src/components/channels/channel-forms/feishu-form.tsx index f44ca502d..ed49e29cf 100644 --- a/web/frontend/src/components/channels/channel-forms/feishu-form.tsx +++ b/web/frontend/src/components/channels/channel-forms/feishu-form.tsx @@ -8,6 +8,7 @@ import { import { asStringArray, parseAllowFromInput, + parseConservativeStringListInput, } from "@/components/channels/channel-array-utils" import { getSecretInputPlaceholder } from "@/components/channels/channel-config-fields" import { Field, KeyInput, SwitchCardField } from "@/components/shared-form" @@ -34,6 +35,13 @@ function asBool(value: unknown): boolean { return typeof value === "boolean" ? value : false } +function asRecord(value: unknown): Record { + if (value && typeof value === "object" && !Array.isArray(value)) { + return value as Record + } + return {} +} + export function FeishuForm({ config, onChange, @@ -43,6 +51,7 @@ export function FeishuForm({ arrayFieldResetVersion, }: FeishuFormProps) { const { t } = useTranslation() + const groupTriggerConfig = asRecord(config.group_trigger) return (
@@ -137,6 +146,37 @@ export function FeishuForm({
+ + + +
+ { + onChange("group_trigger", { + ...groupTriggerConfig, + mention_only: checked, + }) + }} + ariaLabel={t("channels.field.groupTriggerMentionOnly")} + /> +
+ + onChange("random_reaction_emoji", value)} + placeholder={t("channels.field.randomReactionEmojiPlaceholder")} + parser={parseConservativeStringListInput} + fieldPath="random_reaction_emoji" + registerFlusher={registerArrayFieldFlusher} + resetVersion={arrayFieldResetVersion} + /> +
+
) } diff --git a/web/frontend/src/i18n/locales/en.json b/web/frontend/src/i18n/locales/en.json index f58aff66a..cbeca2463 100644 --- a/web/frontend/src/i18n/locales/en.json +++ b/web/frontend/src/i18n/locales/en.json @@ -359,6 +359,9 @@ "placeholderText": "Placeholder Text", "groupTriggerMentionOnly": "Group Mention Only", "groupTriggerPrefixes": "Group Trigger Prefixes", + "groupTriggerPrefixesPlaceholder": "e.g. /, !, ?", + "randomReactionEmoji": "Random Reaction Emoji", + "randomReactionEmojiPlaceholder": "e.g. THUMBSUP, HEART, SMILE", "isLark": "Lark (International)", "allowFrom": "Allow From", "allowFromPlaceholder": "e.g. 123456, 789012", @@ -393,6 +396,7 @@ "placeholderEnabled": "Enable temporary placeholder messages before the final reply is sent.", "groupTriggerMentionOnly": "In group chats, respond only when the bot is mentioned.", "groupTriggerPrefixes": "Custom group-chat trigger prefixes. Add items one by one, or paste multiple values at once.", + "randomReactionEmoji": "PicoClaw adds emoji reactions to user messages to confirm receipt. Example: \"THUMBSUP\", \"HEART\", \"SMILE\". Leave empty to use the default \"Pin\" emoji.", "isLark": "Use Lark international domain (open.larksuite.com) instead of Feishu domain (open.feishu.cn).", "allowFrom": "Allowed user or group IDs. Add items one by one, or paste multiple values at once.", "allowOrigins": "Allowed origin domains. Add items one by one, or paste multiple values at once.", diff --git a/web/frontend/src/i18n/locales/zh.json b/web/frontend/src/i18n/locales/zh.json index 21d6e57cf..410604953 100644 --- a/web/frontend/src/i18n/locales/zh.json +++ b/web/frontend/src/i18n/locales/zh.json @@ -359,6 +359,9 @@ "placeholderText": "占位文案", "groupTriggerMentionOnly": "群聊仅提及时响应", "groupTriggerPrefixes": "群聊触发前缀", + "groupTriggerPrefixesPlaceholder": "例如 /, !, ?", + "randomReactionEmoji": "随机表情回应", + "randomReactionEmojiPlaceholder": "例如 THUMBSUP, HEART, SMILE", "isLark": "Lark(国际版)", "allowFrom": "允许来源", "allowFromPlaceholder": "例如 123456, 789012", @@ -393,6 +396,7 @@ "placeholderEnabled": "在最终回复发送前,先发送临时占位消息", "groupTriggerMentionOnly": "在群聊中仅当提及机器人时才响应", "groupTriggerPrefixes": "群聊触发前缀。可逐项添加,也支持一次粘贴多个值。", + "randomReactionEmoji": "PicoClaw 会对用户消息添加表情回复以确认已收到。例如:\"THUMBSUP\", \"HEART\", \"SMILE\"。留空则使用默认的 \"Pin\" 表情。", "isLark": "使用 Lark 国际版域名(open.larksuite.com)替代飞书域名(open.feishu.cn)", "allowFrom": "允许访问的用户或群组 ID。可逐项添加,也支持一次粘贴多个值。", "allowOrigins": "允许访问的来源域名。可逐项添加,也支持一次粘贴多个值。",