From c4ab2657c07b23d2c62acde7829ad33f98c8cd7f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 3 Jul 2023 22:18:14 -0700 Subject: slash commands and better designed user input box --- extension/react-app/src/tabs/gui.tsx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'extension/react-app/src/tabs') diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index cccd184e..40256f86 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -20,6 +20,7 @@ import { useSelector } from "react-redux"; import { RootStore } from "../redux/store"; import LoadingCover from "../components/LoadingCover"; import { postVscMessage } from "../vscode"; +import UserInputContainer from "../components/UserInputContainer"; const TopGUIDiv = styled.div` overflow: hidden; @@ -152,6 +153,14 @@ function GUI(props: GUIProps) { setHistory(state.history); setHighlightedRanges(state.highlighted_ranges); setUserInputQueue(state.user_input_queue); + setAvailableSlashCommands( + state.slash_commands.map((c: any) => { + return { + name: `/${c.name}`, + description: c.description, + }; + }) + ); setStepsOpen((prev) => { const nextStepsOpen = [...prev]; for ( @@ -168,17 +177,6 @@ function GUI(props: GUIProps) { scrollToBottom(); } }); - client?.onAvailableSlashCommands((commands) => { - console.log("Received available slash commands: ", commands); - setAvailableSlashCommands( - commands.map((c) => { - return { - name: "/" + c.name, - description: c.description, - }; - }) - ); - }); }, [client]); useEffect(() => { @@ -283,7 +281,15 @@ function GUI(props: GUIProps) { )} {history?.timeline.map((node: HistoryNode, index: number) => { - return ( + return node.step.name === "User Input" ? ( + { + client?.deleteAtIndex(index); + }} + > + {node.step.description as string} + + ) : ( history?.current_index} historyNode={node} - onRefinement={(input: string) => { - client?.sendRefinementInput(input, index); - }} onReverse={() => { client?.reverseToIndex(index); }} -- cgit v1.2.3-70-g09d2