Make end call tool can be cancelled

This commit is contained in:
Xin Wang
2026-08-12 09:18:40 +08:00
parent fc026e765e
commit d0bb5b3868
15 changed files with 350 additions and 48 deletions

View File

@@ -95,6 +95,7 @@ type ToolForm = {
messageType: "none" | "custom";
customMessage: string;
captureReason: boolean;
allowEndInterruption: boolean;
method: HttpMethod;
url: string;
timeoutSeconds: string;
@@ -125,6 +126,7 @@ function blankForm(): ToolForm {
messageType: "none",
customMessage: "",
captureReason: true,
allowEndInterruption: false,
method: "GET",
url: "",
timeoutSeconds: "15",
@@ -159,6 +161,8 @@ function formFromTool(tool: Tool): ToolForm {
base.messageType = tool.definition.config.messageType;
base.customMessage = tool.definition.config.customMessage;
base.captureReason = tool.definition.config.captureReason;
base.allowEndInterruption =
tool.definition.config.allowEndInterruption ?? false;
return base;
}
if (tool.definition.type === "mcp") return base;
@@ -262,6 +266,7 @@ function payloadFromForm(form: ToolForm): ToolUpsert {
? form.customMessage
: "",
captureReason: form.captureReason,
allowEndInterruption: form.allowEndInterruption,
},
},
};
@@ -958,6 +963,23 @@ function SystemToolFields({
}
/>
</div>
<div className="flex items-center justify-between gap-4 rounded-lg border border-hairline-strong px-4 py-3">
<div>
<div className="font-medium text-foreground">允许用户撤销结束</div>
<div className="mt-0.5 text-xs text-muted-foreground">
结束语期间收到有效输入时撤销结束;语音遵循 Agent 的打断配置
</div>
</div>
<Switch
checked={form.allowEndInterruption}
onCheckedChange={(allowEndInterruption) =>
setForm((current) => ({
...current,
allowEndInterruption,
}))
}
/>
</div>
</>
)}
</div>

View File

@@ -513,6 +513,7 @@ export type SystemToolDefinition = {
messageType: "none" | "custom";
customMessage: string;
captureReason: boolean;
allowEndInterruption?: boolean;
};
};