Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
import { QuestionMarkIcon } from "@radix-ui/react-icons";
import { BrainIcon } from "@/components/icons/BrainIcon";
import { BlockMarkdown } from "@/components/AgentMarkdown";
import { cn } from "@/util/utils";
import { ObserverThought } from "../types/workflowRunTypes";
type Props = {
active: boolean;
thought: ObserverThought;
onClick: (thought: ObserverThought) => void;
cardClassName?: string;
};
function ThoughtCard({ thought, onClick, active, cardClassName }: Props) {
const body = thought.answer || thought.thought;
const titleText = body ? "Thought" : "Thinking";
return (
<div
className={cn(
"group rounded-md bg-slate-elevation4 ring-1 ring-transparent transition-all duration-200",
active
? "ring-1 ring-foreground/40 hover:ring-foreground/40"
: "hover:ring-foreground/25",
cardClassName,
)}
>
<button
type="button"
onClick={() => onClick(thought)}
className="flex w-full cursor-pointer flex-col gap-1 rounded-md px-3 py-2 text-left outline-none focus-visible:ring-1 focus-visible:ring-foreground/40"
>
<div className="flex min-h-[24px] items-center gap-2">
<BrainIcon className="size-4 shrink-0 text-tertiary-foreground" />
<span className="shrink-0 text-xs text-tertiary-foreground">
{titleText}
</span>
<span className="ml-auto flex shrink-0 items-center gap-1 rounded bg-slate-elevation5 px-1.5 py-0.5 text-[10px] text-muted-foreground">
<QuestionMarkIcon className="size-3" />
Decision
</span>
</div>
{body && (
<div className="break-words text-xs text-foreground dark:text-slate-200">
<BlockMarkdown text={body} />
</div>
)}
</button>
</div>
);
}
export { ThoughtCard };