Code cleanup

This commit is contained in:
Daniel D Orlando 2023-04-06 06:07:16 -07:00
parent 61cb2858bb
commit fbeff7a461
5 changed files with 4 additions and 145 deletions

View file

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { useRecoilValue, useRecoilState } from 'recoil';
import { useState } from 'react';
import { useRecoilState } from 'recoil';
import { cn } from '~/utils';
import { Button } from '../../ui/Button.tsx';
import { Settings2 } from 'lucide-react';
@ -18,25 +18,12 @@ function BingAIOptions() {
const { endpoint, conversationId } = conversation;
const { toneStyle, context, systemMessage, jailbreak } = conversation;
// useEffect(() => {
// if (endpoint !== 'bingAI') return;
// const mustInAdvancedMode = context !== null || systemMessage !== null;
// if (mustInAdvancedMode && !advancedMode) setAdvancedMode(true);
// }, [conversation, advancedMode]);
if (endpoint !== 'bingAI') return null;
if (conversationId !== 'new') return null;
const triggerAdvancedMode = () => setAdvancedMode(prev => !prev);
const switchToSimpleMode = () => {
// setConversation(prevState => ({
// ...prevState,
// context: null,
// systemMessage: null
// }));
setAdvancedMode(false);
};

View file

@ -12,21 +12,11 @@ function ChatGPTOptions() {
const endpointsConfig = useRecoilValue(store.endpointsConfig);
// useEffect(() => {
// if (endpoint !== 'chatGPTBrowser') return;
// }, [conversation]);
if (endpoint !== 'chatGPTBrowser') return null;
if (conversationId !== 'new') return null;
const models = endpointsConfig?.['chatGPTBrowser']?.['availableModels'] || [];
// const modelMap = new Map([
// ['Default (GPT-3.5)', 'text-davinci-002-render-sha'],
// ['Legacy (GPT-3.5)', 'text-davinci-002-render-paid'],
// ['GPT-4', 'gpt-4']
// ]);
const setOption = param => newValue => {
let update = {};
update[param] = newValue;

View file

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import { useState } from 'react';
import { Settings2 } from 'lucide-react';
import { useRecoilState, useRecoilValue } from 'recoil';
import SelectDropDown from '../../ui/SelectDropDown';
@ -21,20 +21,6 @@ function OpenAIOptions() {
const endpointsConfig = useRecoilValue(store.endpointsConfig);
// useEffect(() => {
// if (endpoint !== 'openAI') return;
// const mustInAdvancedMode =
// chatGptLabel !== null ||
// promptPrefix !== null ||
// temperature !== 1 ||
// top_p !== 1 ||
// presence_penalty !== 0 ||
// frequency_penalty !== 0;
// if (mustInAdvancedMode && !advancedMode) setAdvancedMode(true);
// }, [conversation, advancedMode]);
if (endpoint !== 'openAI') return null;
if (conversationId !== 'new') return null;
@ -43,15 +29,6 @@ function OpenAIOptions() {
const triggerAdvancedMode = () => setAdvancedMode(prev => !prev);
const switchToSimpleMode = () => {
// setConversation(prevState => ({
// ...prevState,
// chatGptLabel: null,
// promptPrefix: null,
// temperature: 1,
// top_p: 1,
// presence_penalty: 0,
// frequency_penalty: 0
// }));
setAdvancedMode(false);
};
@ -79,16 +56,6 @@ function OpenAIOptions() {
(!advancedMode ? ' show' : '')
}
>
{/* <ModelSelect
model={model}
availableModels={availableModels}
onChange={setOption('model')}
type="button"
className={cn(
cardStyle,
' z-50 flex h-[40px] items-center justify-center px-4 hover:bg-slate-50 data-[state=open]:bg-slate-50 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600'
)}
/> */}
<SelectDropDown
value={model}
setValue={setOption('model')}