Auto-reply: normalize stop matching and add multilingual triggers (#25103)

* Auto-reply tests: cover multilingual abort triggers

* Auto-reply: normalize multilingual abort triggers

* Gateway: route chat stop matching through abort parser

* Gateway tests: cover chat stop parsing variants

* Auto-reply tests: cover Russian and German stop words

* Auto-reply: add Russian and German abort triggers

* Gateway tests: include Russian and German stop forms

* Telegram tests: route Russian and German stop forms to control lane

* Changelog: note multilingual abort stop coverage

* Changelog: add shared credit for abort shortcut update
This commit is contained in:
Vincent Koc
2026-02-24 01:07:25 -05:00
committed by GitHub
parent b817600533
commit 4b316c33db
6 changed files with 76 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import {
abortChatRunById,
isChatStopCommandText,
type ChatAbortOps,
type ChatAbortControllerEntry,
} from "./chat-abort.js";
@@ -42,6 +43,22 @@ function createOps(params: {
};
}
describe("isChatStopCommandText", () => {
it("matches slash and standalone multilingual stop forms", () => {
expect(isChatStopCommandText(" /STOP!!! ")).toBe(true);
expect(isChatStopCommandText("stop please")).toBe(true);
expect(isChatStopCommandText("停止")).toBe(true);
expect(isChatStopCommandText("やめて")).toBe(true);
expect(isChatStopCommandText("توقف")).toBe(true);
expect(isChatStopCommandText("остановись")).toBe(true);
expect(isChatStopCommandText("halt")).toBe(true);
expect(isChatStopCommandText("stopp")).toBe(true);
expect(isChatStopCommandText("pare")).toBe(true);
expect(isChatStopCommandText("/status")).toBe(false);
expect(isChatStopCommandText("keep going")).toBe(false);
});
});
describe("abortChatRunById", () => {
it("broadcasts aborted payload with partial message when buffered text exists", () => {
const runId = "run-1";

View File

@@ -1,4 +1,4 @@
import { isAbortTrigger } from "../auto-reply/reply/abort.js";
import { isAbortRequestText } from "../auto-reply/reply/abort.js";
export type ChatAbortControllerEntry = {
controller: AbortController;
@@ -9,11 +9,7 @@ export type ChatAbortControllerEntry = {
};
export function isChatStopCommandText(text: string): boolean {
const trimmed = text.trim();
if (!trimmed) {
return false;
}
return trimmed.toLowerCase() === "/stop" || isAbortTrigger(trimmed);
return isAbortRequestText(text);
}
export function resolveChatRunExpiresAtMs(params: {