diff --git a/surfsense_web/components/assistant-ui/thread.tsx b/surfsense_web/components/assistant-ui/thread.tsx index 639ef8a89..59797fc72 100644 --- a/surfsense_web/components/assistant-ui/thread.tsx +++ b/surfsense_web/components/assistant-ui/thread.tsx @@ -123,6 +123,10 @@ const ThreadContent: FC = () => { }} /> + !thread.isEmpty}> +
+ + { - router.push(`/dashboard/${searchSpaceId}/new-chat`); - }, 0); + // Immediately set the browser URL so the page remounts with a clean /new-chat path + window.history.replaceState(null, "", `/dashboard/${searchSpaceId}/new-chat`); + // Force-remount the page component to reset all React state synchronously + setChatResetKey((k) => k + 1); + // Sync Next.js router internals so useParams/usePathname stay correct going forward + router.replace(`/dashboard/${searchSpaceId}/new-chat`); } else { - // Normal navigation - router is in sync router.push(`/dashboard/${searchSpaceId}/new-chat`); } }, [router, searchSpaceId, currentThreadState.id, params?.chat_id, resetCurrentThread]); diff --git a/surfsense_web/components/tool-ui/generic-hitl-approval.tsx b/surfsense_web/components/tool-ui/generic-hitl-approval.tsx index 48d0d3764..2a26b18f7 100644 --- a/surfsense_web/components/tool-ui/generic-hitl-approval.tsx +++ b/surfsense_web/components/tool-ui/generic-hitl-approval.tsx @@ -1,7 +1,7 @@ "use client"; import type { ToolCallMessagePartComponent } from "@assistant-ui/react"; -import { CornerDownLeftIcon, ShieldAlertIcon, ShieldCheckIcon } from "lucide-react"; +import { CornerDownLeftIcon, Pen } from "lucide-react"; import { useCallback, useEffect, useMemo, useState } from "react"; import { TextShimmerLoader } from "@/components/prompt-kit/loader"; import { Button } from "@/components/ui/button"; @@ -134,17 +134,14 @@ function GenericApprovalCard({ return (
{/* Header */} -
-
- -
-
+
+

{phase === "rejected" ? `${displayName} — Rejected` : phase === "processing" || phase === "complete" ? `${displayName} — Approved` - : `Approve: ${displayName}`} + : displayName}

{phase === "processing" ? ( @@ -163,13 +160,24 @@ function GenericApprovalCard({

)}
+ {phase === "pending" && canEdit && !isEditing && ( + + )}
{/* Description */} {toolDescription && phase === "pending" && ( <>
-
+

{toolDescription}

@@ -179,7 +187,7 @@ function GenericApprovalCard({ {Object.keys(args).length > 0 && ( <>
-
+

Parameters

{phase === "pending" && isEditing ? (
-
+
{allowedDecisions.includes("approve") && ( )} - {canEdit && !isEditing && ( - - )} {allowedDecisions.includes("reject") && (