Fix full verbosity: show reasoning, tool calls expanded with results
- Full mode shows Thinking blocks with expand/collapse - Full mode shows all assistant messages including tool-only - Full mode expands tool calls by default with results (2000 char limit) - Session delete with confirm - Improved deploy script generates service files dynamically
This commit is contained in:
+44
-11
@@ -1,12 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { use, useState, useRef } from "react";
|
||||
import { ArrowLeft, Send, Loader2, Eye, RefreshCw } from "lucide-react";
|
||||
import { ArrowLeft, Send, Loader2, Eye, RefreshCw, Trash2 } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useSession, useMessages } from "@/lib/hooks";
|
||||
import { timeAgo, formatTokens, platformBadgeClass } from "@/lib/utils";
|
||||
import { MessageBubble } from "@/components/MessageBubble";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export type Verbosity = "compact" | "normal" | "full";
|
||||
|
||||
@@ -19,6 +20,8 @@ const VERBOSITY_OPTIONS: { id: Verbosity; label: string }[] = [
|
||||
export default function SessionReplayPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = use(params);
|
||||
const qc = useQueryClient();
|
||||
const router = useRouter();
|
||||
const [confirmDelete, setConfirmDelete] = useState(false);
|
||||
const { data: sessionData } = useSession(id);
|
||||
const { data: messagesData, isLoading } = useMessages(id);
|
||||
const [input, setInput] = useState("");
|
||||
@@ -33,17 +36,15 @@ export default function SessionReplayPage({ params }: { params: Promise<{ id: st
|
||||
|
||||
// Filter based on verbosity
|
||||
let visibleMessages = messages.filter((m) => {
|
||||
if (verbosity === "compact") return m.role === "user" || (m.role === "assistant" && m.content);
|
||||
return m.role === "user" || m.role === "assistant";
|
||||
}).reverse();
|
||||
|
||||
// In compact mode, skip assistant messages that are only tool calls (no text)
|
||||
if (verbosity === "compact") {
|
||||
visibleMessages = visibleMessages.filter((m) => {
|
||||
if (m.role === "assistant" && !m.content?.trim()) return false;
|
||||
if (m.role === "user") return true;
|
||||
if (m.role === "assistant") {
|
||||
if (verbosity === "compact") return !!m.content?.trim();
|
||||
if (verbosity === "normal") return !!m.content?.trim() || !!m.tool_calls;
|
||||
// full: show everything including tool-only and reasoning-only messages
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).reverse();
|
||||
|
||||
const toolResults = new Map<string, { name: string; content: string }>();
|
||||
for (const m of messages) {
|
||||
@@ -74,6 +75,11 @@ export default function SessionReplayPage({ params }: { params: Promise<{ id: st
|
||||
qc.invalidateQueries({ queryKey: ["session", id] });
|
||||
};
|
||||
|
||||
const deleteSession = async () => {
|
||||
await fetch("/api/sessions/" + id, { method: "DELETE" });
|
||||
router.push("/history");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col" style={{ minHeight: "calc(100vh - 6rem)" }}>
|
||||
{/* Header */}
|
||||
@@ -96,6 +102,33 @@ export default function SessionReplayPage({ params }: { params: Promise<{ id: st
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* Delete */}
|
||||
{confirmDelete ? (
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
onClick={deleteSession}
|
||||
className="px-2 py-1 rounded-lg text-[11px] font-semibold"
|
||||
style={{ background: "rgba(255,59,48,0.12)", color: "#ff3b30" }}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setConfirmDelete(false)}
|
||||
className="px-2 py-1 rounded-lg text-[11px]"
|
||||
style={{ color: "var(--text-3)" }}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => setConfirmDelete(true)}
|
||||
className="p-1.5 rounded-lg active:bg-white/[0.04]"
|
||||
style={{ color: "var(--text-3)" }}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
)}
|
||||
{/* Refresh */}
|
||||
<button
|
||||
onClick={() => { qc.invalidateQueries({ queryKey: ["messages", id] }); qc.invalidateQueries({ queryKey: ["session", id] }); }}
|
||||
|
||||
Reference in New Issue
Block a user