fix: isolate startup tools and preview dialogs

This commit is contained in:
Xin Wang
2026-08-02 00:07:35 +08:00
parent 0331f8cd07
commit 479a516546
10 changed files with 202 additions and 49 deletions
@@ -645,6 +645,8 @@ function DebugVoicePanel({
const recording = status === "connecting" || status === "connected";
const [textDraft, setTextDraft] = useState("");
const [inputMode, setInputMode] = useState<DebugInputMode>("mic");
const [clientDialogContainer, setClientDialogContainer] =
useState<HTMLDivElement | null>(null);
const inChatView = view === "chat" && (!SHOW_VOICE_VIZ || showTranscript);
const idleOrFailed = status === "idle" || status === "failed";
const showIdleHub =
@@ -682,10 +684,17 @@ function DebugVoicePanel({
]);
return (
<div className="flex min-h-0 flex-1 flex-col">
<div
ref={setClientDialogContainer}
className="relative isolate flex min-h-0 flex-1 flex-col overflow-hidden"
>
{/* 后端 TTS 音频经 WebRTC 媒体流过来,挂这里播放 */}
<audio ref={audioRef} autoPlay playsInline className="hidden" />
<ClientMessageDialog preview={preview} />
<ClientMessageDialog
preview={preview}
container={clientDialogContainer}
contained
/>
{vision && !showIdleHub ? (
<DebugVisionWorkspace
view={view}
@@ -135,13 +135,6 @@ export function PromptEditor({
]
: otherActions,
});
if (
enabled &&
defaultToolId &&
!form.toolIds.includes(defaultToolId)
) {
updateForm("toolIds", [...form.toolIds, defaultToolId]);
}
}
function updateOpeningMessage(
@@ -254,12 +247,7 @@ export function PromptEditor({
value={openingMessage.toolId}
options={showMessageTools}
noneLabel="请选择 show_message 工具"
onChange={(toolId) => {
updateOpeningMessage({ toolId });
if (toolId && !form.toolIds.includes(toolId)) {
updateForm("toolIds", [...form.toolIds, toolId]);
}
}}
onChange={(toolId) => updateOpeningMessage({ toolId })}
/>
{showMessageTools.length === 0 && (
<p className="text-xs leading-5 text-muted-foreground">
@@ -308,7 +296,8 @@ export function PromptEditor({
/>
</label>
<p className="text-xs leading-5 text-muted-foreground">
弹窗不可通过关闭按钮、Esc 或点击外部跳过;失败时将结束本次通话。
弹窗不可跳过;失败时将结束本次通话。该工具仅用于开场,
如需允许模型后续调用,请另外在“工具”区域勾选。
</p>
</div>
)}