fix(gateway): harden chat abort semantics
This commit is contained in:
@@ -1033,13 +1033,19 @@ export class ClawdbotApp extends LitElement {
|
||||
const trimmed = text.trim();
|
||||
if (!trimmed) return false;
|
||||
const normalized = trimmed.toLowerCase();
|
||||
return normalized === "/stop" || normalized === "stop" || normalized === "abort";
|
||||
if (normalized === "/stop") return true;
|
||||
return (
|
||||
normalized === "stop" ||
|
||||
normalized === "esc" ||
|
||||
normalized === "abort" ||
|
||||
normalized === "wait" ||
|
||||
normalized === "exit"
|
||||
);
|
||||
}
|
||||
|
||||
async handleAbortChat() {
|
||||
if (!this.connected) return;
|
||||
this.chatMessage = "";
|
||||
if (!this.chatRunId) return;
|
||||
await abortChatRun(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,12 +95,13 @@ export async function sendChatMessage(state: ChatState, message: string): Promis
|
||||
export async function abortChatRun(state: ChatState): Promise<boolean> {
|
||||
if (!state.client || !state.connected) return false;
|
||||
const runId = state.chatRunId;
|
||||
if (!runId) return false;
|
||||
try {
|
||||
await state.client.request("chat.abort", {
|
||||
sessionKey: state.sessionKey,
|
||||
runId,
|
||||
});
|
||||
await state.client.request(
|
||||
"chat.abort",
|
||||
runId
|
||||
? { sessionKey: state.sessionKey, runId }
|
||||
: { sessionKey: state.sessionKey },
|
||||
);
|
||||
return true;
|
||||
} catch (err) {
|
||||
state.lastError = String(err);
|
||||
|
||||
Reference in New Issue
Block a user