Skip to content

Commit 433358a

Browse files
xuyushun441-sysos-zhuangclaude
authored
fix(app-shell): make AI-build "开始搭建" send a gate-matching approval (#2023)
The proposed-plan card's confirm button ("开始搭建") sent the Chinese message "就按这个方案搭建吧。", which the cloud confirm gate's APPROVAL_RE (service-ai-studio confirm-gate.ts) does NOT recognize as approval — it anchors Chinese approval on 确认 / 直接搭建. So clicking sent a message the agent re-proposed on instead of building, and the button looked inert (typing a "确认…" reply worked, which is the tell). Align both zh approve messages with the gate (确认-anchored): planApproveMessage "就按这个方案搭建吧。" → "确认,开始搭建。" planApproveDefaultsMessage "就按你的合理假设直接搭建,…" → "确认搭建,未决问题按你的合理假设和默认处理。" across the two hosts that wire them (i18n zh locale used by AiChatPage, and ConsoleFloatingChatbot's inline zh locale). English already matched ("build it as proposed" / "build it with your best"). Adds an i18n test that pins both messages to the gate's 确认 anchor so a future reword can't silently re-break the button. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8c34607 commit 433358a

3 files changed

Lines changed: 30 additions & 6 deletions

File tree

packages/app-shell/src/layout/ConsoleFloatingChatbot.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,12 @@ function buildChatLocale(
141141
planApprove: '开始搭建',
142142
planAdjust: '调整方案',
143143
planBuilt: '已搭建',
144-
planApproveMessage: '就按这个方案搭建吧。',
145-
planApproveDefaultsMessage: '就按你的合理假设直接搭建,未决问题用默认即可。',
144+
// These messages the button SENDS must match the cloud confirm gate's
145+
// APPROVAL_RE (service-ai-studio confirm-gate.ts) or the agent re-proposes
146+
// and "开始搭建" looks inert — the gate anchors Chinese approval on 确认 /
147+
// 直接搭建, so a bare "…搭建吧" does NOT match. Keep these 确认-anchored.
148+
planApproveMessage: '确认,开始搭建。',
149+
planApproveDefaultsMessage: '确认搭建,未决问题按你的合理假设和默认处理。',
146150
planAnswer: (question: string, option: string) => `关于「${question}」,我选择「${option}」。`,
147151
publishOk: '已发布,对象已生效。',
148152
publishFailed: '发布失败',

packages/i18n/src/__tests__/i18n.test.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,26 @@ describe('@object-ui/i18n', () => {
9393
expect(i18n.t('console.ai.planApproveHint')).toBe('回复以确认或调整该方案。');
9494
expect(i18n.t('console.ai.planApprove')).toBe('开始搭建');
9595
expect(i18n.t('console.ai.planAdjust')).toBe('调整方案');
96-
expect(i18n.t('console.ai.planApproveMessage')).toBe('就按这个方案搭建吧。');
97-
expect(i18n.t('console.ai.planApproveDefaultsMessage')).toBe('就按你的合理假设直接搭建,未决问题用默认即可。');
96+
expect(i18n.t('console.ai.planApproveMessage')).toBe('确认,开始搭建。');
97+
expect(i18n.t('console.ai.planApproveDefaultsMessage')).toBe('确认搭建,未决问题按你的合理假设和默认处理。');
9898
expect(i18n.t('console.ai.nextSteps')).toBe('下一步');
9999
});
100100

101+
// Regression guard: the "开始搭建" button SENDS these two messages, and the
102+
// cloud confirm gate (service-ai-studio confirm-gate.ts APPROVAL_RE) only
103+
// treats Chinese text as approval when it is 确认-anchored (e.g. "确认搭建").
104+
// A bare "…搭建吧" silently fails the gate → the agent re-proposes and the
105+
// button looks inert. Keep both messages matching the gate's 确认 anchor.
106+
it('AI plan-approve messages stay anchored on the confirm gate keyword (确认)', () => {
107+
const i18n = createI18n({ defaultLanguage: 'zh', detectBrowserLanguage: false });
108+
// Mirror of the cloud APPROVAL_RE Chinese clause (confirm-gate.ts). Kept
109+
// narrow on purpose: a plain build REQUEST ("帮我搭建一个 CRM") must NOT match.
110+
const gate = /[,]?\s*(|||)?\s*(|||||)|/;
111+
expect(i18n.t('console.ai.planApproveMessage')).toMatch(gate);
112+
expect(i18n.t('console.ai.planApproveDefaultsMessage')).toMatch(gate);
113+
expect('帮我搭建一个 CRM').not.toMatch(gate);
114+
});
115+
101116
it('translates common keys in Japanese', () => {
102117
const i18n = createI18n({ defaultLanguage: 'ja', detectBrowserLanguage: false });
103118
expect(i18n.t('common.save')).toBe('保存');

packages/i18n/src/locales/zh.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,13 @@ const zh = {
11721172
planApproveHint: '回复以确认或调整该方案。',
11731173
planApprove: '开始搭建',
11741174
planAdjust: '调整方案',
1175-
planApproveMessage: '就按这个方案搭建吧。',
1176-
planApproveDefaultsMessage: '就按你的合理假设直接搭建,未决问题用默认即可。',
1175+
// The two messages the "开始搭建" button SENDS (not the label above) must
1176+
// match the cloud confirm gate's APPROVAL_RE (service-ai-studio
1177+
// confirm-gate.ts), or the agent re-proposes instead of building and the
1178+
// button looks inert. The gate anchors Chinese approval on 确认 (or
1179+
// 直接搭建) — a bare "…搭建吧" does NOT match. Keep these 确认-anchored.
1180+
planApproveMessage: '确认,开始搭建。',
1181+
planApproveDefaultsMessage: '确认搭建,未决问题按你的合理假设和默认处理。',
11771182
planAnswerMessage: '关于「{{question}}」,我选择「{{option}}」。',
11781183
justNow: '刚刚',
11791184
minutesAgo: '{{count}} 分钟前',

0 commit comments

Comments
 (0)