Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Preserve fullwidth punctuation in spoken questions

focuspoints604880d7601a
diff --git a/shared/live-approval.test.ts b/shared/live-approval.test.ts
index c649a5253f..00dff7e750 100644
--- a/shared/live-approval.test.ts
+++ b/shared/live-approval.test.ts
@@ -78,6 +78,11 @@ describe("spoken prompts", () => {
"Ask the user, in your own words: Which one? Then delegate their answer.",
);
});
+ it.each(["选哪一个?", "选哪一个??"])("does not append an ASCII question mark to %s", (subtitle) => {
+ expect(spokenQuestionPrompt(card({ requestId: "r1", subtitle, options: ["主账户", "储蓄账户"] }))).toBe(
+ "Ask the user, in your own words: 选哪一个? The options are 主账户, 储蓄账户. Then delegate their answer.",
+ );
+ });
it("has fixed copy for the call", () => {
expect(LIVE_COPY.granted).toBe("Thanks, I'll go ahead.");
expect(LIVE_COPY.denied).toBe("Okay, I won't do it.");
diff --git a/shared/live-approval.ts b/shared/live-approval.ts
index 1455f8a52b..0187312b03 100644
--- a/shared/live-approval.ts
+++ b/shared/live-approval.ts
@@ -119,8 +119,7 @@ export function spokenSignInPrompt(site: string): string {
export function spokenQuestionPrompt(card: OptionCardData): string {
const detail = brief(card.subtitle || card.title);
const choices = card.options.length ? ` The options are ${card.options.join(", ")}.` : "";
- // brief() drops the detail's own closing mark, so the "?" is never doubled
- return `Ask the user, in your own words: ${detail}?${choices} Then delegate their answer.`;
+ return `Ask the user, in your own words: ${detail}${detail.endsWith("?") ? "" : "?"}${choices} Then delegate their answer.`;
}
export const LIVE_COPY = {