From 021612f5ae304e340256c3aed7587680a737ec45 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 8 Feb 2024 15:29:41 -0300 Subject: [PATCH] Add provider field to AddNewVariableButton component --- .../components/addNewVariableButton.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx b/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx index f30cdbc55..101b60286 100644 --- a/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx +++ b/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx @@ -1,4 +1,5 @@ import { useState } from "react"; +import InputComponent from "../../../components/inputComponent"; import { Button } from "../../../components/ui/button"; import { Input } from "../../../components/ui/input"; import { Label } from "../../../components/ui/label"; @@ -12,15 +13,17 @@ import { useGlobalVariablesStore } from "../../../stores/globalVariables"; export default function AddNewVariableButton(): JSX.Element { const [key, setKey] = useState(""); const [value, setValue] = useState(""); + const [provider, setProvider] = useState(""); const [open, setOpen] = useState(false); const addGlobalVariable = useGlobalVariablesStore( (state) => state.addGlobalVariable ); function handleSaveVariable() { - registerGlobalVariable(key, value).then((_) => { - addGlobalVariable(key, value); + registerGlobalVariable(key, value, provider).then((_) => { + addGlobalVariable(key, value, provider); setKey(""); setValue(""); + setProvider(""); setOpen(false); }); } @@ -45,6 +48,16 @@ export default function AddNewVariableButton(): JSX.Element { }} placeholder="example name" > + + { + setProvider(e); + }} + password={false} + options={["OPENAI_API_KEY", "ANTHROPIC_API_KEY"]} + placeholder="example provider" + >