From 95363a5b52f3bf73531ac76b00178fa79ca97661 Mon Sep 17 00:00:00 2001
From: Nate Sesti <33237525+sestinj@users.noreply.github.com>
Date: Thu, 28 Sep 2023 01:02:52 -0700
Subject: Past input (#513)

* feat: :construction: use ComboBox in place of UserInputContainer

* feat: :construction: adding context to previous inputs steps

* feat: :sparkles: preview context items on click

* feat: :construction: more work on context items ui

* style: :construction: working out the details of ctx item buttons

* feat: :sparkles: getting the final details

* fix: :bug: fix height of ctx items bar

* fix: :bug: last couple of details

* fix: :bug: pass model param through to hf inference api

* fix: :loud_sound: better logging for timeout

* feat: :sparkles: option to set the meilisearch url

* fix: :bug: fix height of past inputs
---
 extension/react-app/src/pages/gui.tsx | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

(limited to 'extension/react-app/src/pages/gui.tsx')

diff --git a/extension/react-app/src/pages/gui.tsx b/extension/react-app/src/pages/gui.tsx
index a93ca9a0..12835121 100644
--- a/extension/react-app/src/pages/gui.tsx
+++ b/extension/react-app/src/pages/gui.tsx
@@ -17,7 +17,6 @@ import { usePostHog } from "posthog-js/react";
 import { useDispatch, useSelector } from "react-redux";
 import { RootStore } from "../redux/store";
 import { postVscMessage } from "../vscode";
-import UserInputContainer from "../components/UserInputContainer";
 import { isMetaEquivalentKeyPressed } from "../util";
 import {
   setBottomMessage,
@@ -30,6 +29,7 @@ import RingLoader from "../components/RingLoader";
 import {
   setServerState,
   temporarilyClearSession,
+  temporarilyCreateNewUserInput,
   temporarilyPushToUserInputQueue,
 } from "../redux/slices/serverStateReducer";
 import TimelineItem from "../components/TimelineItem";
@@ -76,11 +76,8 @@ const TitleTextInput = styled(TextInput)`
 const StepsDiv = styled.div`
   position: relative;
   background-color: transparent;
-  padding-left: 8px;
-  padding-right: 8px;
 
   & > * {
-    z-index: 1;
     position: relative;
   }
 
@@ -331,7 +328,7 @@ function GUI(props: GUIProps) {
       }
 
       client.sendMainInput(input);
-      dispatch(temporarilyPushToUserInputQueue(input));
+      dispatch(temporarilyCreateNewUserInput(input));
 
       // Increment localstorage counter for popup
       const counter = localStorage.getItem("mainTextEntryCounter");
@@ -645,10 +642,19 @@ function GUI(props: GUIProps) {
             <>
               {node.step.name === "User Input" ? (
                 node.step.hide || (
-                  <UserInputContainer
-                    active={getStepsInUserInputGroup(index).some((i) => {
-                      return history.timeline[i].active;
-                    })}
+                  <ComboBox
+                    isMainInput={false}
+                    value={node.step.description as string}
+                    active={
+                      getStepsInUserInputGroup(index).some((i) => {
+                        return history.timeline[i].active;
+                      }) || history.timeline[index].active
+                    }
+                    onEnter={(e, value) => {
+                      if (value) client?.editStepAtIndex(value, index);
+                      e?.stopPropagation();
+                      e?.preventDefault();
+                    }}
                     groupIndices={getStepsInUserInputGroup(index)}
                     onToggle={(isOpen: boolean) => {
                       // Collapse all steps in the section
@@ -678,10 +684,7 @@ function GUI(props: GUIProps) {
                         client?.deleteAtIndex(i);
                       });
                     }}
-                    historyNode={node}
-                  >
-                    {node.step.description as string}
-                  </UserInputContainer>
+                  />
                 )
               ) : (
                 <TimelineItem
@@ -761,8 +764,9 @@ function GUI(props: GUIProps) {
 
       <div ref={aboveComboBoxDivRef} />
       <ComboBox
+        isMainInput={true}
         ref={mainTextInputRef}
-        onEnter={(e) => {
+        onEnter={(e, _) => {
           onMainTextInput(e);
           e?.stopPropagation();
           e?.preventDefault();
-- 
cgit v1.2.3-70-g09d2

