diff --git a/client/src/components/Input/OpenAIOptions/index.jsx b/client/src/components/Input/OpenAIOptions/index.jsx index b7fdfc280c..0192ac8f0a 100644 --- a/client/src/components/Input/OpenAIOptions/index.jsx +++ b/client/src/components/Input/OpenAIOptions/index.jsx @@ -1,35 +1,59 @@ import React, { useState, useEffect, forwardRef } from 'react'; import { Tabs, TabsList, TabsTrigger } from '../../ui/Tabs.tsx'; -import { useRecoilValue, useRecoilState } from 'recoil'; +import { useRecoilValue, useRecoilState, useSetRecoilState } from 'recoil'; import { Button } from '../../ui/Button.tsx'; import store from '~/store'; function OpenAIOptions({ conversation = {} }) { const { endpoint } = conversation; - const { advancedMode, setAdvancedMode } = useState(false); + const [advancedMode, setAdvancedMode] = useState(false); + const setConversation = useSetRecoilState(store.conversation); const triggerAdvancedMode = () => setAdvancedMode(prev => !prev); + const switchToSimpleMode = () => { + setAdvancedMode(false); + setConversation(prevState => ({ + ...prevState, + chatGptLabel: null, + promptPrefix: null, + temperature: 0.8, + top_p: 1, + presence_penalty: 1 + })); + }; + if (endpoint !== 'openAI') return null; const { model } = conversation; const cardStyle = - 'shadow-md px-4 h-[40px] rounded-md min-w-[75px] font-normal bg-white border-black/10 border dark:bg-gray-700 text-black dark:text-white'; + 'shadow-md rounded-md min-w-[75px] font-normal bg-white border-black/10 border dark:bg-gray-700 text-black dark:text-white'; return ( <> -
+
+
+
content
); diff --git a/client/src/style.css b/client/src/style.css index 86e343e63c..4d143cd4d2 100644 --- a/client/src/style.css +++ b/client/src/style.css @@ -28,6 +28,31 @@ transition: all 1s ease-in-out; } */ +.openAIOptions-simple-container { + pointer-events: none; + opacity: 0; + transition: all 0.5s ease-in-out; +} + +.openAIOptions-simple-container.show { + pointer-events: fill; + opacity: 1; +} + +.openAIOptions-advanced-container { + pointer-events: none; + opacity: 0; + transition: all 0.2s ease-in-out; + transform: scaleY(0); + transform-origin: bottom center; +} + +.openAIOptions-advanced-container.show { + pointer-events: fill; + opacity: 1; + transform: scaleY(1) +} + .bing-styles { position: absolute; left: 0;