Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3243-3114-cut-29-feishu.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Connectors page's Feishu row reads in the window's language — its failed-connect line, and the sentence a refused connect, disconnect, mode, allowed-sender or send leaves — together with the Composio search hint and app-limit sentence; the host's own data (address, status code, open_id) stays exactly as the host wrote it ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)).
44 changes: 39 additions & 5 deletions core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,18 @@ var HOST_ERRORS = [
[/^A binding needs the member id$/, "绑定需要 member id"],
[/^A Project memory entry needs text$/, "项目记忆条目需要文字"],
[/^A Project memory entry is at most (\d+) characters$/, "项目记忆条目最多 $1 个字符"],
[/^Unknown Project (\S+)$/, "找不到项目 $1"]
[/^Unknown Project (\S+)$/, "找不到项目 $1"],
// #3114 cut 29: the Connectors page's Feishu row, and two Composio leftovers on the same page.
// The four below carry the host's own data — a webhook origin, a status code, Feishu's own error
// code, Composio's message — and copy it through: data is never translated.
[/^A Feishu webhook must be https on (.+)$/, "飞书 webhook 必须是 $1 上的 https 地址"],
[/^Feishu answered (\d+)$/, "飞书返回了 $1"],
[/^Feishu did not accept the webhook \((.+)\)$/, "飞书不接受这个 webhook($1)"],
[/^Not sent: Feishu refused the answer \((.+)\)$/, "没发出去:飞书拒收($1)"],
// `connector-send` names the notifier's own refusal, and its fallback literal, in the brackets.
[/^Feishu refused the message \((.+)\)$/, "飞书拒收这条消息($1)"],
[/^Pick up to (\d+) apps$/, "最多选 $1 个应用"],
[/^Composio answered (\d+)([\s\S]*)$/, "Composio 返回了 $1$2"]
];
var HOST_ZH = {
"Request failed": "请求失败",
Expand Down Expand Up @@ -1840,7 +1851,30 @@ var HOST_ZH = {
"In use in {n} room: ": "正在 {n} 个房间里使用:",
"In use in {n} rooms: ": "正在 {n} 个房间里使用:",
"This room only: ": "只在这个房间使用:",
" +{n} more": ",还有 {n} 个"
" +{n} more": ",还有 {n} 个",
// #3114 cut 29: the Connectors page's Feishu row in a Chinese window — the line under a failed
// connect, and the sentence a refused connect, disconnect, mode, allowed-sender or send leaves.
// A sentence with data in it is one of the HOST_ERRORS patterns above, not an entry here.
"Could not reach Feishu": "连不上飞书",
"Feishu addresses must start with https://": "飞书地址必须以 https:// 开头",
"A Feishu App ID and App Secret are both needed before the long connection can dial.": "自建应用的长连接需要飞书 App ID 和 App Secret 才能拨号",
"the Feishu long connection did not open": "飞书长连接没有建立",
"Paste the webhook URL Feishu gave you": "请粘贴飞书给你的 webhook 地址",
"Feishu did not answer in time — the test message may already be in the chat; check before connecting again": "飞书没有及时答复——测试消息可能已经发到群里;再连接前先确认一下",
"Feishu did not answer in time — the message may already be in the chat; check before sending again": "飞书没有及时答复——消息可能已经发到群里;再发送前先确认一下",
"Feishu is rate-limiting this webhook; try again in a minute": "飞书正在限流这个 webhook;请过一分钟再试",
"Paste the App ID and App Secret Feishu gave the app": "请粘贴飞书给这个应用的 App ID 和 App Secret",
"Feishu did not accept this App ID and App Secret": "飞书不接受这个 App ID 和 App Secret",
"Choose how to connect Feishu first": "请先选择飞书的连接方式",
"This connector has no allowed senders": "这个连接器没有允许发送的人",
"Paste the open_id of the sender to allow": "请粘贴要允许的发送者 open_id",
"Connect Feishu as an app first": "请先把飞书按自建应用连接",
"Type a message first": "请先输入消息",
"Not sent: could not reach Feishu": "没发出去:连不上飞书",
"Not sent: Feishu refused the app token while sending the answer": "没发出去:发送时飞书不认这个应用 token",
"Not sent: this answer has no Feishu chat to go to.": "没发出去:这条回答没有可去的飞书群。",
"Not sent: connect Feishu first, so the answer has a way out.": "没发出去:请先连接飞书,回答才有出去的路。",
"Connect Feishu first": "请先连接飞书"
};
Object.assign(ZH, HOST_ZH);
var fill = (text2, params) => params ? text2.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match) : text2;
Expand Down Expand Up @@ -19826,7 +19860,7 @@ var ABOUT = {
};
function statusText2(connector) {
if (connector.state === "connecting") return t("Connecting…");
if (connector.state === "error") return t("Could not connect: {error}", { error: connector.error ?? "" });
if (connector.state === "error") return t("Could not connect: {error}", { error: hostText(connector.error ?? "") });
if (connector.state === "ready" && connector.kind === "channel") {
return connector.mode === "app" ? t("Connected: app, over the long connection") : t("Connected: custom bot webhook");
}
Expand Down Expand Up @@ -19950,7 +19984,7 @@ function AppPicker({ apps, onChange, search, statuses = {} }) {
{ className: "bt-connector-apps" },
apps.length > 0 ? (0, import_react42.createElement)("div", { className: "bt-states", "aria-label": t("Picked apps") }, apps.map((slug) => (0, import_react42.createElement)(AppChip, { key: slug, name: nameOf(slug), status: statuses[slug], onRemove: () => onChange(apps.filter((app) => app !== slug)) }))) : null,
(0, import_react42.createElement)("input", { className: "bt-input", type: "search", value: query, spellCheck: false, "aria-label": t("Search apps"), placeholder: t("Search Composio apps"), onChange: (event) => setQuery(event.target.value) }),
failed ? (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("Could not search Composio: {error}", { error: failed })) : null,
failed ? (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("Could not search Composio: {error}", { error: hostText(failed) })) : null,
(0, import_react42.createElement)("div", { className: "bt-states", "aria-label": t("Apps to add") }, results.length === 0 ? (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("No apps match")) : results.map((app) => (0, import_react42.createElement)("button", { key: app.slug, type: "button", className: "bt-state", "aria-pressed": false, onClick: () => {
names.current.set(app.slug, app.name);
onChange([...apps, app.slug]);
Expand Down Expand Up @@ -20150,7 +20184,7 @@ function ConnectorRow({ connector, roster, actions }) {
(0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || apps.length === 0, onClick: saveApps }, busy ? t("Connecting…") : t("Save"))
)
) : null,
error ? (0, import_react42.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null
error ? (0, import_react42.createElement)("div", { className: "bt-connector-error", role: "alert" }, hostText(error)) : null
);
}
function ConnectorsPage({ roster, actions }) {
Expand Down
10 changes: 6 additions & 4 deletions core/src/client/connectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ConnectorIcon } from './icons.js'
import { SwitchRow } from './bot-settings.js'
import { lockedWindow } from './schedules.js'
import { ConnectorBots, usageText } from './connector-bots.js'
import { t } from './i18n.js'
import { hostText, t } from './i18n.js'
import { copiedToClipboard } from '../shared/remote-label.js'

const TOKEN_URL = 'https://github.com/settings/personal-access-tokens/new'
Expand Down Expand Up @@ -42,7 +42,9 @@ const ABOUT = {

function statusText(connector) {
if (connector.state === 'connecting') return t('Connecting…')
if (connector.state === 'error') return t('Could not connect: {error}', { error: connector.error ?? '' })
// The host wrote the failure; a zh window reads it in Chinese, and the host's own data inside it
// (an origin, a status code, an open_id) is copied through as written (#3243).
if (connector.state === 'error') return t('Could not connect: {error}', { error: hostText(connector.error ?? '') })
if (connector.state === 'ready' && connector.kind === 'channel') {
return connector.mode === 'app' ? t('Connected: app, over the long connection') : t('Connected: custom bot webhook')
}
Expand Down Expand Up @@ -138,7 +140,7 @@ export function AppPicker({ apps, onChange, search, statuses = {} }) {
apps.length > 0 ? h('div', { className: 'bt-states', 'aria-label': t('Picked apps') }, apps.map(slug =>
h(AppChip, { key: slug, name: nameOf(slug), status: statuses[slug], onRemove: () => onChange(apps.filter(app => app !== slug)) }))) : null,
h('input', { className: 'bt-input', type: 'search', value: query, spellCheck: false, 'aria-label': t('Search apps'), placeholder: t('Search Composio apps'), onChange: event => setQuery(event.target.value) }),
failed ? h('span', { className: 'bt-set-hint' }, t('Could not search Composio: {error}', { error: failed })) : null,
failed ? h('span', { className: 'bt-set-hint' }, t('Could not search Composio: {error}', { error: hostText(failed) })) : null,
h('div', { className: 'bt-states', 'aria-label': t('Apps to add') }, results.length === 0
? h('span', { className: 'bt-set-hint' }, t('No apps match'))
: results.map(app => h('button', { key: app.slug, type: 'button', className: 'bt-state', 'aria-pressed': false, onClick: () => { names.current.set(app.slug, app.name); onChange([...apps, app.slug]) } }, app.name))))
Expand Down Expand Up @@ -275,7 +277,7 @@ function ConnectorRow({ connector, roster, actions }) {
h('span', { className: 'bt-connector-link' }),
h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy, onClick: () => { setPicking(false); setError(null) } }, t('Cancel')),
h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy || apps.length === 0, onClick: saveApps }, busy ? t('Connecting…') : t('Save')))) : null,
error ? h('div', { className: 'bt-connector-error', role: 'alert' }, error) : null)
error ? h('div', { className: 'bt-connector-error', role: 'alert' }, hostText(error)) : null)
}

// Settings → Connectors: one row per connector.
Expand Down
34 changes: 34 additions & 0 deletions core/src/client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,17 @@ const HOST_ERRORS = [
[/^A Project memory entry needs text$/, '项目记忆条目需要文字'],
[/^A Project memory entry is at most (\d+) characters$/, '项目记忆条目最多 $1 个字符'],
[/^Unknown Project (\S+)$/, '找不到项目 $1'],
// #3114 cut 29: the Connectors page's Feishu row, and two Composio leftovers on the same page.
// The four below carry the host's own data — a webhook origin, a status code, Feishu's own error
// code, Composio's message — and copy it through: data is never translated.
[/^A Feishu webhook must be https on (.+)$/, '飞书 webhook 必须是 $1 上的 https 地址'],
[/^Feishu answered (\d+)$/, '飞书返回了 $1'],
[/^Feishu did not accept the webhook \((.+)\)$/, '飞书不接受这个 webhook($1)'],
[/^Not sent: Feishu refused the answer \((.+)\)$/, '没发出去:飞书拒收($1)'],
// `connector-send` names the notifier's own refusal, and its fallback literal, in the brackets.
[/^Feishu refused the message \((.+)\)$/, '飞书拒收这条消息($1)'],
[/^Pick up to (\d+) apps$/, '最多选 $1 个应用'],
[/^Composio answered (\d+)([\s\S]*)$/, 'Composio 返回了 $1$2'],
]
const HOST_ZH = {
'Request failed': '请求失败',
Expand Down Expand Up @@ -1801,6 +1812,29 @@ const HOST_ZH = {
'In use in {n} rooms: ': '正在 {n} 个房间里使用:',
'This room only: ': '只在这个房间使用:',
' +{n} more': ',还有 {n} 个',
// #3114 cut 29: the Connectors page's Feishu row in a Chinese window — the line under a failed
// connect, and the sentence a refused connect, disconnect, mode, allowed-sender or send leaves.
// A sentence with data in it is one of the HOST_ERRORS patterns above, not an entry here.
'Could not reach Feishu': '连不上飞书',
'Feishu addresses must start with https://': '飞书地址必须以 https:// 开头',
'A Feishu App ID and App Secret are both needed before the long connection can dial.': '自建应用的长连接需要飞书 App ID 和 App Secret 才能拨号',
'the Feishu long connection did not open': '飞书长连接没有建立',
'Paste the webhook URL Feishu gave you': '请粘贴飞书给你的 webhook 地址',
'Feishu did not answer in time — the test message may already be in the chat; check before connecting again': '飞书没有及时答复——测试消息可能已经发到群里;再连接前先确认一下',
'Feishu did not answer in time — the message may already be in the chat; check before sending again': '飞书没有及时答复——消息可能已经发到群里;再发送前先确认一下',
'Feishu is rate-limiting this webhook; try again in a minute': '飞书正在限流这个 webhook;请过一分钟再试',
'Paste the App ID and App Secret Feishu gave the app': '请粘贴飞书给这个应用的 App ID 和 App Secret',
'Feishu did not accept this App ID and App Secret': '飞书不接受这个 App ID 和 App Secret',
'Choose how to connect Feishu first': '请先选择飞书的连接方式',
'This connector has no allowed senders': '这个连接器没有允许发送的人',
'Paste the open_id of the sender to allow': '请粘贴要允许的发送者 open_id',
'Connect Feishu as an app first': '请先把飞书按自建应用连接',
'Type a message first': '请先输入消息',
'Not sent: could not reach Feishu': '没发出去:连不上飞书',
'Not sent: Feishu refused the app token while sending the answer': '没发出去:发送时飞书不认这个应用 token',
'Not sent: this answer has no Feishu chat to go to.': '没发出去:这条回答没有可去的飞书群。',
'Not sent: connect Feishu first, so the answer has a way out.': '没发出去:请先连接飞书,回答才有出去的路。',
'Connect Feishu first': '请先连接飞书',
}
Object.assign(ZH, HOST_ZH)

Expand Down
Loading
Loading