Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Moves state machine graph view to under traces
elijahbenizzyc4e5c98e5ca5
diff --git a/telemetry/ui/src/components/routes/app/AppView.tsx b/telemetry/ui/src/components/routes/app/AppView.tsxindex 37f685c1..164f6bd5 100644--- a/telemetry/ui/src/components/routes/app/AppView.tsx+++ b/telemetry/ui/src/components/routes/app/AppView.tsx@@ -7,6 +7,7 @@ import { TwoColumnLayout, TwoRowLayout } from '../../common/layout';import { AppStateView } from './StateMachine';import { useEffect, useState } from 'react';import { Status } from '../../../utils';+import { GraphView } from './GraphView';/*** Gives a list of prior actions. Note they're currently sorted in order from@@ -184,23 +185,43 @@ export const AppView = (props: {return timeB - timeA;});const Layout = props.orientation === 'stacked_horizontal' ? TwoColumnLayout : TwoRowLayout;+ const currentStep = stepsSorted.find(+ (step) => step.step_start_log.sequence_id === currentActionIndex+ );+ const hoverAction = hoverSequenceID+ ? stepsSorted.find((step) => step.step_start_log.sequence_id === hoverSequenceID)+ : undefined;return (<Layoutmode={minimizedTable ? 'first-minimal' : 'half'}firstItem={- <div className="overflow-y-scroll hide-scrollbar h-full w-full">- <StepList- steps={stepsSorted}- currentHoverIndex={hoverSequenceID}- setCurrentHoverIndex={setHoverSequenceID}- currentSelectedIndex={currentActionIndex}- setCurrentSelectedIndex={setCurrentActionIndex}- numPriorIndices={NUM_PREVIOUS_ACTIONS}- autoRefresh={autoRefresh}- setAutoRefresh={setAutoRefresh}- minimized={minimizedTable}- setMinimized={setMinimizedTable}- />+ <div className="w-full h-full flex flex-col">+ <div+ className={`overflow-y-scroll hide-scrollbar w-full ${props.orientation === 'stacked_vertical' ? 'h-full' : 'h-1/2'}`}+ >+ <StepList+ steps={stepsSorted}+ currentHoverIndex={hoverSequenceID}+ setCurrentHoverIndex={setHoverSequenceID}+ currentSelectedIndex={currentActionIndex}+ setCurrentSelectedIndex={setCurrentActionIndex}+ numPriorIndices={NUM_PREVIOUS_ACTIONS}+ autoRefresh={autoRefresh}+ setAutoRefresh={setAutoRefresh}+ minimized={minimizedTable}+ setMinimized={setMinimizedTable}+ />+ </div>+ {props.orientation === 'stacked_horizontal' && (+ <div className="h-1/2 w-[full]">+ <GraphView+ stateMachine={data.application}+ currentAction={currentStep}+ highlightedActions={previousActions}+ hoverAction={hoverAction}+ />+ </div>+ )}</div>}secondItem={@@ -208,12 +229,9 @@ export const AppView = (props: {steps={stepsSorted}stateMachine={data.application}highlightedActions={previousActions}- hoverAction={- hoverSequenceID- ? stepsSorted.find((step) => step.step_start_log.sequence_id === hoverSequenceID)- : undefined- }+ hoverAction={hoverAction}currentSequenceID={currentActionIndex}+ displayGraphAsTab={props.orientation === 'stacked_vertical'} // in this case we want the graph as a tab/>}/>diff --git a/telemetry/ui/src/components/routes/app/GraphView.tsx b/telemetry/ui/src/components/routes/app/GraphView.tsxindex b5013eef..8324911f 100644--- a/telemetry/ui/src/components/routes/app/GraphView.tsx+++ b/telemetry/ui/src/components/routes/app/GraphView.tsx@@ -8,7 +8,6 @@ import ReactFlow, {EdgeProps,Handle,MarkerType,- MiniMap,Position,ReactFlowProvider,getBezierPath,@@ -304,20 +303,20 @@ export const _Graph = (props: {currentAction: props.currentAction}}>- <ReactFlow- nodes={nodes}- edges={edges}- edgesUpdatable={false}- nodesDraggable={false}- nodeTypes={nodeTypes}- edgeTypes={edgeTypes}- fitView- maxZoom={100}- minZoom={0.1}- />-- <MiniMap pannable className="pr-10" />- <Controls position="bottom-right" />+ <div className="h-full w-full relative">+ <ReactFlow+ nodes={nodes}+ edges={edges}+ edgesUpdatable={false}+ nodesDraggable={false}+ nodeTypes={nodeTypes}+ edgeTypes={edgeTypes}+ fitView+ maxZoom={100}+ minZoom={0.1}+ />+ <Controls position="bottom-right" className=" relative" />+ </div></NodeStateProvider.Provider>);};diff --git a/telemetry/ui/src/components/routes/app/StateMachine.tsx b/telemetry/ui/src/components/routes/app/StateMachine.tsxindex 25745c23..ca234aa0 100644--- a/telemetry/ui/src/components/routes/app/StateMachine.tsx+++ b/telemetry/ui/src/components/routes/app/StateMachine.tsx@@ -1,9 +1,9 @@import { useState } from 'react';import { ApplicationModel, Step } from '../../../api';import { Tabs } from '../../common/tabs';-import { GraphView } from './GraphView';import { DataView } from './DataView';import { ActionView } from './ActionView';+import { GraphView } from './GraphView';export const AppStateView = (props: {steps: Step[];@@ -11,8 +11,10 @@ export const AppStateView = (props: {highlightedActions: Step[] | undefined;hoverAction: Step | undefined;currentSequenceID: number | undefined;+ displayGraphAsTab: boolean; // for sideways view}) => {- const [currentTab, setCurrentTab] = useState('graph');+ const defaultTab = props.displayGraphAsTab ? 'graph' : 'data';+ const [currentTab, setCurrentTab] = useState(defaultTab);const currentStep = props.steps.find((step) => step.step_start_log.sequence_id === props.currentSequenceID);@@ -23,15 +25,21 @@ export const AppStateView = (props: {const actionModel = props.stateMachine.actions.find((action) => action.name === currentStep?.step_start_log.action);- const tabs = [{ id: 'graph', displayName: 'Graph' }];- if (currentStep) {- tabs.push({ id: 'data', displayName: 'Data' });- tabs.push({ id: 'action', displayName: 'Action' });+ const tabs = [+ { id: 'data', displayName: 'Data' },+ { id: 'action', displayName: 'Action' }+ ];+ if (props.displayGraphAsTab) {+ tabs.push({ id: 'graph', displayName: 'Graph' });}return (<><Tabs tabs={tabs} currentTab={currentTab} setCurrentTab={setCurrentTab} /><div className="px-4 h-full w-full hide-scrollbar overflow-y-auto">+ {currentTab === 'data' && currentStep && (+ <DataView currentStep={currentStep} priorStep={priorStep} />+ )}+ {currentTab === 'action' && currentStep && <ActionView currentAction={actionModel} />}{currentTab === 'graph' && (<GraphViewstateMachine={props.stateMachine}@@ -40,8 +48,6 @@ export const AppStateView = (props: {hoverAction={props.hoverAction}/>)}- {currentTab === 'data' && <DataView currentStep={currentStep} priorStep={priorStep} />}- {currentTab === 'action' && <ActionView currentAction={actionModel} />}</div></>);diff --git a/telemetry/ui/src/components/routes/app/StepList.tsx b/telemetry/ui/src/components/routes/app/StepList.tsxindex 5c2d9c9b..f2c1f079 100644--- a/telemetry/ui/src/components/routes/app/StepList.tsx+++ b/telemetry/ui/src/components/routes/app/StepList.tsx@@ -138,11 +138,9 @@ const ActionTableRow = (props: {setCurrentSelectedIndex={props.setCurrentSelectedIndex}><TableCell className="text-gray-500 w-12 max-w-12 min-w-12">{sequenceID}</TableCell>+ <TableCell className="truncate w-48 min-w-48">{props.step.step_start_log.action}</TableCell>{!props.minimized && (<>- <TableCell className="truncate w-48 min-w-48">- {props.step.step_start_log.action}- </TableCell><TableCell><div className="flex flex-row justify-end"><DateTimeDisplay date={props.step.step_start_log.start_time} mode={'short'} />@@ -393,9 +391,10 @@ export const StepList = (props: {)}</div></TableHeader>+ <TableHeader>Action</TableHeader>+{!props.minimized && (<>- <TableHeader>Action</TableHeader><TableHeader><span className="flex justify-end">Ran</span></TableHeader>