mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 17:21:13 +00:00
fix(openai): add multilingual gpt ack prompts
This commit is contained in:
@@ -109,6 +109,16 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {
|
||||
expect(isLikelyExecutionAckPrompt("Can you do it?")).toBe(false);
|
||||
});
|
||||
|
||||
it("detects short execution approvals across requested locales", () => {
|
||||
expect(isLikelyExecutionAckPrompt("نفذها")).toBe(true);
|
||||
expect(isLikelyExecutionAckPrompt("mach es")).toBe(true);
|
||||
expect(isLikelyExecutionAckPrompt("進めて")).toBe(true);
|
||||
expect(isLikelyExecutionAckPrompt("fais-le")).toBe(true);
|
||||
expect(isLikelyExecutionAckPrompt("adelante")).toBe(true);
|
||||
expect(isLikelyExecutionAckPrompt("vai em frente")).toBe(true);
|
||||
expect(isLikelyExecutionAckPrompt("진행해")).toBe(true);
|
||||
});
|
||||
|
||||
it("adds an ack-turn fast-path instruction for GPT action turns", () => {
|
||||
const instruction = resolveAckExecutionFastPathInstruction({
|
||||
provider: "openai",
|
||||
|
||||
@@ -49,6 +49,31 @@ const ACK_EXECUTION_NORMALIZED_SET = new Set([
|
||||
"make it so",
|
||||
"yes do it",
|
||||
"yep do it",
|
||||
"تمام",
|
||||
"حسنا",
|
||||
"حسنًا",
|
||||
"امض قدما",
|
||||
"نفذها",
|
||||
"mach es",
|
||||
"leg los",
|
||||
"los geht s",
|
||||
"weiter",
|
||||
"やって",
|
||||
"進めて",
|
||||
"そのまま進めて",
|
||||
"allez y",
|
||||
"vas y",
|
||||
"fais le",
|
||||
"continue",
|
||||
"hazlo",
|
||||
"adelante",
|
||||
"sigue",
|
||||
"faz isso",
|
||||
"vai em frente",
|
||||
"pode fazer",
|
||||
"해줘",
|
||||
"진행해",
|
||||
"계속해",
|
||||
]);
|
||||
|
||||
export const PLANNING_ONLY_RETRY_INSTRUCTION =
|
||||
@@ -113,9 +138,10 @@ function shouldApplyPlanningOnlyRetryGuard(params: {
|
||||
|
||||
function normalizeAckPrompt(text: string): string {
|
||||
return text
|
||||
.normalize("NFKC")
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/[`"'.,!?]+/g, " ")
|
||||
.replace(/[\p{P}\p{S}]+/gu, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user