From 5cb59885ecd217463218ec3da57e0214de1baab0 Mon Sep 17 00:00:00 2001 From: Wentao Lyu <35-wentao.lyu@users.noreply.git.stereye.tech> Date: Sat, 1 Apr 2023 03:02:16 +0800 Subject: [PATCH] fix : endpoint option should hide on exist conversation --- .../components/Input/BingAIOptions/index.jsx | 39 ++----------------- .../components/Input/OpenAIOptions/index.jsx | 33 +++++++++------- client/src/components/Input/index.jsx | 16 -------- 3 files changed, 23 insertions(+), 65 deletions(-) diff --git a/client/src/components/Input/BingAIOptions/index.jsx b/client/src/components/Input/BingAIOptions/index.jsx index c17a125334..b1f5783455 100644 --- a/client/src/components/Input/BingAIOptions/index.jsx +++ b/client/src/components/Input/BingAIOptions/index.jsx @@ -1,38 +1,16 @@ -import React, { useState, useEffect, forwardRef } from 'react'; +import React from 'react'; import { useRecoilValue, useRecoilState } from 'recoil'; import { cn } from '~/utils'; -import { Button } from '../../ui/Button.tsx'; import { Tabs, TabsList, TabsTrigger } from '../../ui/Tabs.tsx'; import store from '~/store'; -// function BingStyles(props, ref) { -// const [conversation, setConversation] = useRecoilState(store.conversation) || {}; -// const { endpoint, conversationId, jailbreak, toneStyle } = conversation; -// const messages = useRecoilValue(store.messages); - -// const isBing = endpoint === 'bingAI'; - -// const show = isBing && (!conversationId || messages?.length === 0 || props.show); -// const defaultClasses = -// 'p-2 rounded-md min-w-[75px] font-normal bg-white/[.60] dark:bg-gray-700 text-black text-xs'; -// const defaultSelected = cn(defaultClasses, 'font-medium data-[state=active]:text-white text-xs text-white'); - -// const selectedClass = val => val + '-tab ' + defaultSelected; - -// const changeHandler = value => { -// setConversation(prevState => ({ ...prevState, toneStyle: value })); -// }; - -function BingAIOptions({ ref }) { +function BingAIOptions() { const [conversation, setConversation] = useRecoilState(store.conversation) || {}; - const messages = useRecoilValue(store.messages); const { endpoint, conversationId } = conversation; if (endpoint !== 'bingAI') return null; - - const isBing = endpoint === 'bingAI'; - const show = isBing && (!conversationId || messages?.length === 0); + if (conversationId !== 'new') return null; const changeHandler = value => { setConversation(prevState => ({ ...prevState, toneStyle: value })); @@ -47,16 +25,6 @@ function BingAIOptions({ ref }) { const defaultSelected = cn(defaultClasses, 'font-medium data-[state=active]:text-white text-xs text-white'); const selectedClass = val => val + '-tab ' + defaultSelected; - // return (