This commit is contained in:
bracesproul
2025-03-10 14:17:44 -07:00
parent 2be5034b62
commit 6025daa8fe
4 changed files with 25 additions and 27 deletions

View File

@@ -244,7 +244,13 @@ export function StateView({
} }
return ( return (
<div className="overflow-y-auto pl-6 border-t-[1px] lg:border-t-[0px] lg:border-l-[1px] border-gray-100 flex flex-row gap-0 w-full"> <div
className={cn(
"flex flex-row gap-0 w-full",
view === "state" &&
"border-t-[1px] lg:border-t-[0px] lg:border-l-[1px] border-gray-100 ",
)}
>
{view === "description" && ( {view === "description" && (
<div className="pt-6 pb-2"> <div className="pt-6 pb-2">
<MarkdownText> <MarkdownText>
@@ -253,7 +259,7 @@ export function StateView({
</div> </div>
)} )}
{view === "state" && ( {view === "state" && (
<div className="flex flex-col items-start justify-start gap-1 pt-6 pb-2"> <div className="flex flex-col items-start justify-start gap-1">
{Object.entries(values).map(([k, v], idx) => ( {Object.entries(values).map(([k, v], idx) => (
<StateViewObject <StateViewObject
expanded={expanded} expanded={expanded}
@@ -264,7 +270,7 @@ export function StateView({
))} ))}
</div> </div>
)} )}
<div className="flex gap-2 items-start justify-end pt-6 pr-6"> <div className="flex gap-2 items-start justify-end">
{view === "state" && ( {view === "state" && (
<Button <Button
onClick={() => setExpanded((prev) => !prev)} onClick={() => setExpanded((prev) => !prev)}

View File

@@ -102,7 +102,7 @@ export function ThreadActionsView({
const actionsDisabled = loading || streaming; const actionsDisabled = loading || streaming;
return ( return (
<div className="flex flex-col min-h-full w-full p-12 gap-9"> <div className="flex flex-col min-h-full w-full gap-9">
{/* Header */} {/* Header */}
<div className="flex flex-wrap items-center justify-between w-full gap-3"> <div className="flex flex-wrap items-center justify-between w-full gap-3">
<div className="flex items-center justify-start gap-3"> <div className="flex items-center justify-start gap-3">

View File

@@ -1,7 +1,6 @@
import { StateView } from "./components/state-view"; import { StateView } from "./components/state-view";
import { ThreadActionsView } from "./components/thread-actions-view"; import { ThreadActionsView } from "./components/thread-actions-view";
import { useState } from "react"; import { useState } from "react";
import { cn } from "@/lib/utils";
import { HumanInterrupt } from "@langchain/langgraph/prebuilt"; import { HumanInterrupt } from "@langchain/langgraph/prebuilt";
import { useStreamContext } from "@/providers/Stream"; import { useStreamContext } from "@/providers/Stream";
@@ -11,7 +10,7 @@ interface ThreadViewProps {
export function ThreadView({ interrupt }: ThreadViewProps) { export function ThreadView({ interrupt }: ThreadViewProps) {
const thread = useStreamContext(); const thread = useStreamContext();
const [showDescription, setShowDescription] = useState(true); const [showDescription, setShowDescription] = useState(false);
const [showState, setShowState] = useState(false); const [showState, setShowState] = useState(false);
const showSidePanel = showDescription || showState; const showSidePanel = showDescription || showState;
@@ -36,33 +35,22 @@ export function ThreadView({ interrupt }: ThreadViewProps) {
}; };
return ( return (
<div className="flex flex-col lg:flex-row w-full h-[750px] border-[1px] border-slate-200 rounded-2xl pb-4"> <div className="flex flex-col lg:flex-row w-full h-[80vh] p-8 bg-gray-50/50 rounded-2xl overflow-y-scroll [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent">
<div {showSidePanel ? (
className={cn(
"flex overflow-y-auto",
showSidePanel ? "lg:min-w-1/2 w-full" : "w-full",
)}
>
<ThreadActionsView
interrupt={interrupt}
handleShowSidePanel={handleShowSidePanel}
showState={showState}
showDescription={showDescription}
/>
</div>
<div
className={cn(
showSidePanel ? "flex" : "hidden",
"overflow-y-auto lg:max-w-1/2 w-full",
)}
>
<StateView <StateView
handleShowSidePanel={handleShowSidePanel} handleShowSidePanel={handleShowSidePanel}
description={interrupt.description} description={interrupt.description}
values={thread.values} values={thread.values}
view={showState ? "state" : "description"} view={showState ? "state" : "description"}
/> />
</div> ) : (
<ThreadActionsView
interrupt={interrupt}
handleShowSidePanel={handleShowSidePanel}
showState={showState}
showDescription={showDescription}
/>
)}
</div> </div>
); );
} }

View File

@@ -13,6 +13,10 @@ module.exports = {
md: "calc(var(--radius) - 2px)", md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)", sm: "calc(var(--radius) - 4px)",
}, },
components: {
".scrollbar-pretty":
"overflow-y-scroll [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent",
},
colors: { colors: {
background: "hsl(var(--background))", background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))", foreground: "hsl(var(--foreground))",