diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-03 14:20:21 -0400 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-03 14:20:21 -0400 |
commit | f42b7508736f5a0957ad9fe069c26cf62de0a8d8 (patch) | |
tree | ca088d564f49d435c2a61167f0c5d2d7e0832abb /extension/react-app/src/components/StepContainer.tsx | |
parent | fb4377a036eb2e6063e2c5b5e4882d079c883d5f (diff) | |
download | sncontinue-f42b7508736f5a0957ad9fe069c26cf62de0a8d8.tar.gz sncontinue-f42b7508736f5a0957ad9fe069c26cf62de0a8d8.tar.bz2 sncontinue-f42b7508736f5a0957ad9fe069c26cf62de0a8d8.zip |
error handling and step retry
Diffstat (limited to 'extension/react-app/src/components/StepContainer.tsx')
-rw-r--r-- | extension/react-app/src/components/StepContainer.tsx | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx index f962cbc9..903f9b94 100644 --- a/extension/react-app/src/components/StepContainer.tsx +++ b/extension/react-app/src/components/StepContainer.tsx @@ -18,6 +18,7 @@ import { ChevronDown, ChevronRight, Backward, + ArrowPath, } from "@styled-icons/heroicons-outline"; import { HistoryNode } from "../../../schema/HistoryNode"; import ReactMarkdown from "react-markdown"; @@ -29,6 +30,7 @@ interface StepContainerProps { inFuture: boolean; onRefinement: (input: string) => void; onUserInput: (input: string) => void; + onRetry: () => void; } const MainDiv = styled.div<{ stepDepth: number; inFuture: boolean }>` @@ -135,19 +137,44 @@ function StepContainer(props: StepContainerProps) { > <Backward size="1.6em" onClick={props.onReverse}></Backward> </HeaderButton> */} + + {props.historyNode.observation?.error ? ( + <HeaderButton + onClick={(e) => { + e.stopPropagation(); + props.onRetry(); + }} + > + <ArrowPath size="1.6em" onClick={props.onRetry}></ArrowPath> + </HeaderButton> + ) : ( + <></> + )} </HeaderDiv> {open && ( - <pre> - Step Details: - <br /> - {JSON.stringify(props.historyNode.step, null, 2)} - </pre> + <> + <pre className="overflow-scroll"> + Step Details: + <br /> + {JSON.stringify(props.historyNode.step, null, 2)} + </pre> + </> )} - <ReactMarkdown key={1} className="overflow-scroll"> - {props.historyNode.step.description as any} - </ReactMarkdown> + {props.historyNode.observation?.error ? ( + <> + Error while running step: + <br /> + <pre className="overflow-scroll"> + {props.historyNode.observation.error as string} + </pre> + </> + ) : ( + <ReactMarkdown key={1} className="overflow-scroll"> + {props.historyNode.step.description as any} + </ReactMarkdown> + )} {props.historyNode.step.name === "Waiting for user input" && ( <input |