fix: isolate startup tools and preview dialogs
This commit is contained in:
@@ -120,7 +120,15 @@ function actionVariant(style: MessageActionStyle) {
|
||||
* Renders messages requested by the agent through the generic Client Tool
|
||||
* channel. The tool result is held until the user chooses an action.
|
||||
*/
|
||||
export function ClientMessageDialog({ preview }: { preview: VoicePreview }) {
|
||||
export function ClientMessageDialog({
|
||||
preview,
|
||||
container,
|
||||
contained = false,
|
||||
}: {
|
||||
preview: VoicePreview;
|
||||
container?: HTMLElement | null;
|
||||
contained?: boolean;
|
||||
}) {
|
||||
const { registerClientTool, status } = preview;
|
||||
const [message, setMessage] = useState<MessageState | null>(null);
|
||||
const pendingRef = useRef<PendingMessage | null>(null);
|
||||
@@ -163,6 +171,7 @@ export function ClientMessageDialog({ preview }: { preview: VoicePreview }) {
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
modal={!contained}
|
||||
open={message !== null}
|
||||
onOpenChange={(open) => {
|
||||
if (!open && message?.dismissible) complete("dismissed");
|
||||
@@ -170,6 +179,8 @@ export function ClientMessageDialog({ preview }: { preview: VoicePreview }) {
|
||||
>
|
||||
<DialogContent
|
||||
className="gap-5 sm:max-w-md"
|
||||
portalContainer={container}
|
||||
contained={contained}
|
||||
showCloseButton={message?.dismissible ?? true}
|
||||
onEscapeKeyDown={(event) => {
|
||||
if (!message?.dismissible) event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user