Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

refactor: reformat files to require parens around params (#316)

Dan Orlandoa17b878617ec
diff --git a/api/app/google/GoogleClient.js b/api/app/google/GoogleClient.js
index a494b1a690..819282b4d6 100644
--- a/api/app/google/GoogleClient.js
+++ b/api/app/google/GoogleClient.js
@@ -45,7 +45,7 @@ class GoogleAgent {
}
this.options.examples = this.options.examples.filter(
- obj => obj.input.content !== '' && obj.output.content !== ''
+ (obj) => obj.input.content !== '' && obj.output.content !== ''
);
const modelOptions = this.options.modelOptions || {};
@@ -375,7 +375,7 @@ class GoogleAgent {
let currentMessageId = parentMessageId;
while (currentMessageId) {
// eslint-disable-next-line no-loop-func
- const message = messages.find(m => m.messageId === currentMessageId);
+ const message = messages.find((m) => m.messageId === currentMessageId);
if (!message) {
break;
}
@@ -387,7 +387,7 @@ class GoogleAgent {
return [];
}
- return orderedMessages.map(msg => ({
+ return orderedMessages.map((msg) => ({
isCreatedByUser: msg.isCreatedByUser,
content: msg.text
}));
diff --git a/api/lib/db/migrateDb.js b/api/lib/db/migrateDb.js
index c976251a5e..bff1f0c8df 100644
--- a/api/lib/db/migrateDb.js
+++ b/api/lib/db/migrateDb.js
@@ -110,7 +110,7 @@ async function migrateDb() {
ret[0] = await migrateToStrictFollowParentMessageIdChain();
ret[1] = await migrateToSupportBetterCustomization();
- const isMigrated = !!ret.find(element => !element?.noNeed);
+ const isMigrated = !!ret.find((element) => !element?.noNeed);
if (!isMigrated) console.log('[Migrate] Nothing to migrate');
}
diff --git a/api/lib/parse/getCitations.js b/api/lib/parse/getCitations.js
index 69e142e8b2..63a47e0760 100644
--- a/api/lib/parse/getCitations.js
+++ b/api/lib/parse/getCitations.js
@@ -7,7 +7,7 @@ const getCitations = (res) => {
if (!textBlocks) return '';
let links = textBlocks[textBlocks.length - 1]?.text.match(regex);
if (links?.length === 0 || !links) return '';
- links = links.map(link => link.trim());
+ links = links.map((link) => link.trim());
return links.join('\n');
};
diff --git a/api/models/Conversation.js b/api/models/Conversation.js
index 4b4f08708a..e91299e7f4 100644
--- a/api/models/Conversation.js
+++ b/api/models/Conversation.js
@@ -57,7 +57,7 @@ module.exports = {
// will handle a syncing solution soon
const deletedConvoIds = [];
- convoIds.forEach(convo =>
+ convoIds.forEach((convo) =>
promises.push(
Conversation.findOne({
user,
@@ -120,7 +120,7 @@ module.exports = {
},
deleteConvos: async (user, filter) => {
let toRemove = await Conversation.find({ ...filter, user }).select('conversationId');
- const ids = toRemove.map(instance => instance.conversationId);
+ const ids = toRemove.map((instance) => instance.conversationId);
let deleteCount = await Conversation.deleteMany({ ...filter, user }).exec();
deleteCount.messages = await deleteMessages({ conversationId: { $in: ids } });
return deleteCount;
diff --git a/api/models/Preset.js b/api/models/Preset.js
index de33370e60..1d4094c3f4 100644
--- a/api/models/Preset.js
+++ b/api/models/Preset.js
@@ -39,7 +39,7 @@ module.exports = {
},
deletePresets: async (user, filter) => {
let toRemove = await Preset.find({ ...filter, user }).select('presetId');
- const ids = toRemove.map(instance => instance.presetId);
+ const ids = toRemove.map((instance) => instance.presetId);
let deleteCount = await Preset.deleteMany({ ...filter, user }).exec();
return deleteCount;
}
diff --git a/api/models/plugins/mongoMeili.js b/api/models/plugins/mongoMeili.js
index ef65da7d3e..d157eccacc 100644
--- a/api/models/plugins/mongoMeili.js
+++ b/api/models/plugins/mongoMeili.js
@@ -54,7 +54,7 @@ const createMeiliMongooseModel = function ({ index, indexName, client, attribute
// Find objects into mongodb matching `objectID` from Meili search
const query = {};
// query[primaryKey] = { $in: _.map(data.hits, primaryKey) };
- query[primaryKey] = _.map(data.hits, hit => cleanUpPrimaryKeyValue(hit[primaryKey]));
+ query[primaryKey] = _.map(data.hits, (hit) => cleanUpPrimaryKeyValue(hit[primaryKey]));
// console.log('query', query);
const hitsFromMongoose = await this.find(
query,
diff --git a/api/server/controllers/error.controller.js b/api/server/controllers/error.controller.js
index e22b21c123..1d32f306a5 100644
--- a/api/server/controllers/error.controller.js
+++ b/api/server/controllers/error.controller.js
@@ -10,8 +10,8 @@ const handleDuplicateKeyError = (err, res) => {
//handle validation errors
const handleValidationError = (err, res) => {
console.log('congrats you hit the validation middleware');
- let errors = Object.values(err.errors).map(el => el.message);
- let fields = Object.values(err.errors).map(el => el.path);
+ let errors = Object.values(err.errors).map((el) => el.message);
+ let fields = Object.values(err.errors).map((el) => el.path);
let code = 400;
if (errors.length > 1) {
const formattedErrors = errors.join(' ');
diff --git a/api/server/routes/ask/askBingAI.js b/api/server/routes/ask/askBingAI.js
index ef319e7cd6..25e61bcfc1 100644
--- a/api/server/routes/ask/askBingAI.js
+++ b/api/server/routes/ask/askBingAI.js
@@ -164,7 +164,7 @@ const ask = async ({
text: await handleText(response, true),
suggestions:
response.details.suggestedResponses &&
- response.details.suggestedResponses.map(s => s.text),
+ response.details.suggestedResponses.map((s) => s.text),
unfinished: false,
cancelled: false,
error: false
diff --git a/api/server/routes/ask/askChatGPTBrowser.js b/api/server/routes/ask/askChatGPTBrowser.js
index 068e3f4dbc..97fad58d84 100644
--- a/api/server/routes/ask/askChatGPTBrowser.js
+++ b/api/server/routes/ask/askChatGPTBrowser.js
@@ -39,7 +39,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
};
const availableModels = getChatGPTBrowserModels();
- if (availableModels.find(model => model === endpointOption.model) === undefined)
+ if (availableModels.find((model) => model === endpointOption.model) === undefined)
return handleError(res, { text: 'Illegal request: model' });
console.log('ask log', {
diff --git a/api/server/routes/ask/askGoogle.js b/api/server/routes/ask/askGoogle.js
index 8ff0e14584..60eadc5837 100644
--- a/api/server/routes/ask/askGoogle.js
+++ b/api/server/routes/ask/askGoogle.js
@@ -27,7 +27,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
};
const availableModels = ['chat-bison', 'text-bison'];
- if (availableModels.find(model => model === endpointOption.modelOptions.model) === undefined) {
+ if (availableModels.find((model) => model === endpointOption.modelOptions.model) === undefined) {
return handleError(res, { text: `Illegal request: model` });
}
diff --git a/api/server/routes/ask/askOpenAI.js b/api/server/routes/ask/askOpenAI.js
index 6a7515417e..8fe728792a 100644
--- a/api/server/routes/ask/askOpenAI.js
+++ b/api/server/routes/ask/askOpenAI.js
@@ -64,7 +64,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
};
const availableModels = getOpenAIModels();
- if (availableModels.find(model => model === endpointOption.model) === undefined)
+ if (availableModels.find((model) => model === endpointOption.model) === undefined)
return handleError(res, { text: 'Illegal request: model' });
console.log('ask log', {
diff --git a/api/server/routes/presets.js b/api/server/routes/presets.js
index 235a1fe314..59a1d6051d 100644
--- a/api/server/routes/presets.js
+++ b/api/server/routes/presets.js
@@ -40,7 +40,7 @@ router.post('/delete', requireJwtAuth, async (req, res) => {
try {
await deletePresets(req.user.id, filter);
- const presets = (await getPresets(req.user.id)).map(preset => preset.toObject());
+ const presets = (await getPresets(req.user.id)).map((preset) => preset.toObject());
// console.log('delete preset response', presets);
res.status(201).send(presets);
diff --git a/api/server/services/auth.service.js b/api/server/services/auth.service.js
index c382231bd8..cdad995398 100644
--- a/api/server/services/auth.service.js
+++ b/api/server/services/auth.service.js
@@ -26,7 +26,7 @@ const loginUser = async (user) => {
const logoutUser = async (user, refreshToken) => {
User.findById(user._id).then((user) => {
- const tokenIndex = user.refreshToken.findIndex(item => item.refreshToken === refreshToken);
+ const tokenIndex = user.refreshToken.findIndex((item) => item.refreshToken === refreshToken);
if (tokenIndex !== -1) {
user.refreshToken.id(user.refreshToken[tokenIndex]._id).remove();
diff --git a/api/utils/LoggingSystem.js b/api/utils/LoggingSystem.js
index 679e93c1d2..b22c69b508 100644
--- a/api/utils/LoggingSystem.js
+++ b/api/utils/LoggingSystem.js
@@ -64,7 +64,7 @@ let level = levels.INFO;
module.exports = {
levels,
- setLevel: l => (level = l),
+ setLevel: (l) => (level = l),
log: {
trace: (msg) => {
if (level <= levels.TRACE) return;
diff --git a/client/src/components/Auth/Login.tsx b/client/src/components/Auth/Login.tsx
index 45a28581a1..facaf8f832 100644
--- a/client/src/components/Auth/Login.tsx
+++ b/client/src/components/Auth/Login.tsx
@@ -42,7 +42,7 @@ function Login() {
className="mt-6"
aria-label="Login form"
method="POST"
- onSubmit={handleSubmit(data => login(data))}
+ onSubmit={handleSubmit((data) => login(data))}
>
<div className="mb-2">
<div className="relative">
diff --git a/client/src/components/Auth/Registration.tsx b/client/src/components/Auth/Registration.tsx
index 54ddea0374..38c04f5570 100644
--- a/client/src/components/Auth/Registration.tsx
+++ b/client/src/components/Auth/Registration.tsx
@@ -55,7 +55,7 @@ function Registration() {
className="mt-6"
aria-label="Registration form"
method="POST"
- onSubmit={handleSubmit(data => onRegisterUserFormSubmit(data))}
+ onSubmit={handleSubmit((data) => onRegisterUserFormSubmit(data))}
>
<div className="mb-2">
<div className="relative">
@@ -225,7 +225,7 @@ function Registration() {
return false;
}}
{...register('confirm_password', {
- validate: value => value === password || 'Passwords do not match'
+ validate: (value) => value === password || 'Passwords do not match'
})}
aria-invalid={!!errors.confirm_password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
diff --git a/client/src/components/Auth/ResetPassword.tsx b/client/src/components/Auth/ResetPassword.tsx
index f765c0c127..cb953590a1 100644
--- a/client/src/components/Auth/ResetPassword.tsx
+++ b/client/src/components/Auth/ResetPassword.tsx
@@ -129,7 +129,7 @@ function ResetPassword() {
return false;
}}
{...register('confirm_password', {
- validate: value => value === password || 'Passwords do not match'
+ validate: (value) => value === password || 'Passwords do not match'
})}
aria-invalid={!!errors.confirm_password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
diff --git a/client/src/components/Conversations/Conversation.jsx b/client/src/components/Conversations/Conversation.jsx
index eda119ca52..47676b20ff 100644
--- a/client/src/components/Conversations/Conversation.jsx
+++ b/client/src/components/Conversations/Conversation.jsx
@@ -65,7 +65,7 @@ export default function Conversation({ conversation, retainView }) {
if (updateConvoMutation.isSuccess) {
refreshConversations();
if (conversationId == currentConversation?.conversationId) {
- setCurrentConversation(prevState => ({
+ setCurrentConversation((prevState) => ({
...prevState,
title: titleInput
}));
@@ -99,7 +99,7 @@ export default function Conversation({ conversation, retainView }) {
type="text"
className="m-0 mr-0 w-full border border-blue-500 bg-transparent p-0 text-sm leading-tight outline-none"
value={titleInput}
- onChange={e => setTitleInput(e.target.value)}
+ onChange={(e) => setTitleInput(e.target.value)}
onBlur={onRename}
onKeyDown={handleKeyDown}
/>
diff --git a/client/src/components/Conversations/Pages.jsx b/client/src/components/Conversations/Pages.jsx
index 80ae5ffdca..754d45bbf2 100644
--- a/client/src/components/Conversations/Pages.jsx
+++ b/client/src/components/Conversations/Pages.jsx
@@ -1,7 +1,7 @@
import React from 'react';
export default function Pages({ pageNumber, pages, nextPage, previousPage }) {
- const clickHandler = func => async (e) => {
+ const clickHandler = (func) => async (e) => {
e.preventDefault();
await func();
};
diff --git a/client/src/components/Endpoints/BingAI/Settings.jsx b/client/src/components/Endpoints/BingAI/Settings.jsx
index 787515bd96..18c2b4ce93 100644
--- a/client/src/components/Endpoints/BingAI/Settings.jsx
+++ b/client/src/components/Endpoints/BingAI/Settings.jsx
@@ -17,7 +17,7 @@ function Settings(props) {
const setContext = setOption('context');
const setSystemMessage = setOption('systemMessage');
const setJailbreak = setOption('jailbreak');
- const setToneStyle = value => setOption('toneStyle')(value.toLowerCase());
+ const setToneStyle = (value) => setOption('toneStyle')(value.toLowerCase());
const debouncedContext = useDebounce(context, 250);
const updateTokenCountMutation = useUpdateTokenCountMutation();
@@ -71,7 +71,7 @@ function Settings(props) {
id="context"
disabled={readonly}
value={context || ''}
- onChange={e => setContext(e.target.value || null)}
+ onChange={(e) => setContext(e.target.value || null)}
placeholder="Bing can use up to 7k tokens for 'context', which it can reference for the conversation. The specific limit is not known but may run into errors exceeding 7k tokens"
className={cn(
defaultTextProps,
@@ -123,7 +123,7 @@ function Settings(props) {
id="systemMessage"
disabled={readonly}
value={systemMessage || ''}
- onChange={e => setSystemMessage(e.target.value || null)}
+ onChange={(e) => setSystemMessage(e.target.value || null)}
placeholder="WARNING: Misuse of this feature can get you BANNED from using Bing! Click on 'System Message' for full instructions and the default message if omitted, which is the 'Sydney' preset that is considered safe."
className={cn(
defaultTextProps,
diff --git a/client/src/components/Endpoints/EditPresetDialog.jsx b/client/src/components/Endpoints/EditPresetDialog.jsx
index a0b47a7a09..7e93ad7fe0 100644
--- a/client/src/components/Endpoints/EditPresetDialog.jsx
+++ b/client/src/components/Endpoints/EditPresetDialog.jsx
@@ -131,7 +131,7 @@ const EditPresetDialog = ({ open, onOpenChange, preset: _preset, title }) => {
useEffect(() => {
setPreset(_preset);
- // eslint-disable-next-line react-hooks/exhaustive-deps
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
return (
diff --git a/client/src/components/Endpoints/EndpointOptionsDialog.jsx b/client/src/components/Endpoints/EndpointOptionsDialog.jsx
index 321b885b46..6a2356015b 100644
--- a/client/src/components/Endpoints/EndpointOptionsDialog.jsx
+++ b/client/src/components/Endpoints/EndpointOptionsDialog.jsx
@@ -22,10 +22,10 @@ const EndpointOptionsDialog = ({ open, onOpenChange, preset: _preset, title }) =
setEndpointName('PaLM');
}
- const setOption = param => (newValue) => {
+ const setOption = (param) => (newValue) => {
let update = {};
update[param] = newValue;
- setPreset(prevState => ({
+ setPreset((prevState) => ({
...prevState,
...update
}));
diff --git a/client/src/components/Endpoints/Google/Examples.jsx b/client/src/components/Endpoints/Google/Examples.jsx
index 4225852cce..017dc443ac 100644
--- a/client/src/components/Endpoints/Google/Examples.jsx
+++ b/client/src/components/Endpoints/Google/Examples.jsx
@@ -29,7 +29,7 @@ function Examples({ readonly, examples, setExample, addExample, removeExample, e
id={`input-${idx}`}
disabled={readonly}
value={example?.input?.content || ''}
- onChange={e => setExample(idx, 'input', e.target.value || null)}
+ onChange={(e) => setExample(idx, 'input', e.target.value || null)}
placeholder="Set example input. Example is ignored if empty."
className={cn(
defaultTextProps,
@@ -53,7 +53,7 @@ function Examples({ readonly, examples, setExample, addExample, removeExample, e
id={`output-${idx}`}
disabled={readonly}
value={example?.output?.content || ''}
- onChange={e => setExample(idx, 'output', e.target.value || null)}
+ onChange={(e) => setExample(idx, 'output', e.target.value || null)}
placeholder={`Set example output. Example is ignored if empty.`}
className={cn(
defaultTextProps,
diff --git a/client/src/components/Endpoints/OpenAI/Settings.jsx b/client/src/components/Endpoints/OpenAI/Settings.jsx
index 7c067064f8..03d22afbd9 100644
--- a/client/src/components/Endpoints/OpenAI/Settings.jsx
+++ b/client/src/components/Endpoints/OpenAI/Settings.jsx
@@ -66,7 +66,7 @@ function Settings(props) {
id="chatGptLabel"
disabled={readonly}
value={chatGptLabel || ''}
- onChange={e => setChatGptLabel(e.target.value || null)}
+ onChange={(e) => setChatGptLabel(e.target.value || null)}
placeholder="Set a custom name for ChatGPT"
className={cn(
defaultTextProps,
@@ -82,7 +82,7 @@ function Settings(props) {
id="promptPrefix"
disabled={readonly}
value={promptPrefix || ''}
- onChange={e => setPromptPrefix(e.target.value || null)}
+ onChange={(e) => setPromptPrefix(e.target.value || null)}
placeholder="Set custom instructions. Defaults to: 'You are ChatGPT, a large language model trained by OpenAI.'"
className={cn(
defaultTextProps,
@@ -102,7 +102,7 @@ function Settings(props) {
id="temp-int"
disabled={readonly}
value={temperature}
- onChange={value => setTemperature(value)}
+ onChange={(value) => setTemperature(value)}
max={2}
min={0}
step={0.01}
@@ -119,7 +119,7 @@ function Settings(props) {
<Slider
disabled={readonly}
value={[temperature]}
- onValueChange={value => setTemperature(value[0])}
+ onValueChange={(value) => setTemperature(value[0])}
doubleClickHandler={() => setTemperature(1)}
max={2}
min={0}
@@ -139,7 +139,7 @@ function Settings(props) {
id="top-p-int"
disabled={readonly}
value={topP}
- onChange={value => setTopP(value)}
+ onChange={(value) => setTopP(value)}
max={1}
min={0}
step={0.01}
@@ -156,7 +156,7 @@ function Settings(props) {
<Slider
disabled={readonly}
value={[topP]}
- onValueChange={value => setTopP(value[0])}
+ onValueChange={(value) => setTopP(value[0])}
doubleClickHandler={() => setTopP(1)}
max={1}
min={0}
@@ -177,7 +177,7 @@ function Settings(props) {
id="freq-penalty-int"
disabled={readonly}
value={freqP}
- onChange={value => setFreqP(value)}
+ onChange={(value) => setFreqP(value)}
max={2}
min={-2}
step={0.01}
@@ -194,7 +194,7 @@ function Settings(props) {
<Slider
disabled={readonly}
value={[freqP]}
- onValueChange={value => setFreqP(value[0])}
+ onValueChange={(value) => setFreqP(value[0])}
doubleClickHandler={() => setFreqP(0)}
max={2}
min={-2}
@@ -215,7 +215,7 @@ function Settings(props) {
id="pres-penalty-int"
disabled={readonly}
value={presP}
- onChange={value => setPresP(value)}
+ onChange={(value) => setPresP(value)}
max={2}
min={-2}
step={0.01}
@@ -232,7 +232,7 @@ function Settings(props) {
<Slider
disabled={readonly}
value={[presP]}
- onValueChange={value => setPresP(value[0])}
+ onValueChange={(value) => setPresP(value[0])}
doubleClickHandler={() => setPresP(0)}
max={2}
min={-2}
diff --git a/client/src/components/Endpoints/SaveAsPresetDialog.jsx b/client/src/components/Endpoints/SaveAsPresetDialog.jsx
index 6df655b761..5689661bb9 100644
--- a/client/src/components/Endpoints/SaveAsPresetDialog.jsx
+++ b/client/src/components/Endpoints/SaveAsPresetDialog.jsx
@@ -44,7 +44,7 @@ const SaveAsPresetDialog = ({ open, onOpenChange, preset }) => {
<Input
id="chatGptLabel"
value={title || ''}
- onChange={e => setTitle(e.target.value || '')}
+ onChange={(e) => setTitle(e.target.value || '')}
placeholder="Set a custom name, in case you can find this preset"
className={cn(
defaultTextProps,
diff --git a/client/src/components/Input/BingAIOptions/index.jsx b/client/src/components/Input/BingAIOptions/index.jsx
index 56f6b89ecf..3237e8ef8d 100644
--- a/client/src/components/Input/BingAIOptions/index.jsx
+++ b/client/src/components/Input/BingAIOptions/index.jsx
@@ -21,7 +21,7 @@ function BingAIOptions({ show }) {
if (endpoint !== 'bingAI') return null;
if (conversationId !== 'new' && !show) return null;
- const triggerAdvancedMode = () => setAdvancedMode(prev => !prev);
+ const triggerAdvancedMode = () => setAdvancedMode((prev) => !prev);
const switchToSimpleMode = () => {
setAdvancedMode(false);
@@ -31,10 +31,10 @@ function BingAIOptions({ show }) {
setSaveAsDialogShow(true);
};
- const setOption = param => (newValue) => {
+ const setOption = (param) => (newValue) => {
let update = {};
update[param] = newValue;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
@@ -48,7 +48,7 @@ function BingAIOptions({ show }) {
defaultClasses,
'font-medium data-[state=active]:text-white text-xs text-white'
);
- const selectedClass = val => val + '-tab ' + defaultSelected;
+ const selectedClass = (val) => val + '-tab ' + defaultSelected;
return (
<>
@@ -61,7 +61,7 @@ function BingAIOptions({ show }) {
<SelectDropDown
title="Mode"
value={jailbreak ? 'Sydney' : 'BingAI'}
- setValue={value => setOption('jailbreak')(value === 'Sydney')}
+ setValue={(value) => setOption('jailbreak')(value === 'Sydney')}
availableValues={['BingAI', 'Sydney']}
showAbove={true}
showLabel={false}
@@ -78,7 +78,7 @@ function BingAIOptions({ show }) {
cardStyle +
' z-50 flex h-[40px] flex-none items-center justify-center px-0 hover:bg-slate-50 dark:hover:bg-gray-600'
}
- onValueChange={value => setOption('toneStyle')(value.toLowerCase())}
+ onValueChange={(value) => setOption('toneStyle')(value.toLowerCase())}
>
<TabsList className="bg-white/[.60] dark:bg-gray-700">
<TabsTrigger
diff --git a/client/src/components/Input/ChatGPTOptions/index.jsx b/client/src/components/Input/ChatGPTOptions/index.jsx
index 9c1c8a5d33..c1ad95edaf 100644
--- a/client/src/components/Input/ChatGPTOptions/index.jsx
+++ b/client/src/components/Input/ChatGPTOptions/index.jsx
@@ -17,10 +17,10 @@ function ChatGPTOptions() {
const models = endpointsConfig?.['chatGPTBrowser']?.['availableModels'] || [];
- const setOption = param => (newValue) => {
+ const setOption = (param) => (newValue) => {
let update = {};
update[param] = newValue;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
diff --git a/client/src/components/Input/GoogleOptions/index.jsx b/client/src/components/Input/GoogleOptions/index.jsx
index 382c1e9392..c14965fc38 100644
--- a/client/src/components/Input/GoogleOptions/index.jsx
+++ b/client/src/components/Input/GoogleOptions/index.jsx
@@ -29,8 +29,8 @@ function GoogleOptions() {
const models = endpointsConfig?.['google']?.['availableModels'] || [];
- const triggerAdvancedMode = () => setAdvancedMode(prev => !prev);
- const triggerExamples = () => setShowExamples(prev => !prev);
+ const triggerAdvancedMode = () => setAdvancedMode((prev) => !prev);
+ const triggerExamples = () => setShowExamples((prev) => !prev);
const switchToSimpleMode = () => {
setAdvancedMode(false);
@@ -40,10 +40,10 @@ function GoogleOptions() {
setSaveAsDialogShow(true);
};
- const setOption = param => (newValue) => {
+ const setOption = (param) => (newValue) => {
let update = {};
update[param] = newValue;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
@@ -56,7 +56,7 @@ function GoogleOptions() {
currentExample[type] = { content: newValue };
current[i] = currentExample;
update.examples = current;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
@@ -67,7 +67,7 @@ function GoogleOptions() {
let current = conversation?.examples.slice() || [];
current.push({ input: { content: '' }, output: { content: '' } });
update.examples = current;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
@@ -78,7 +78,7 @@ function GoogleOptions() {
let current = conversation?.examples.slice() || [];
if (current.length <= 1) {
update.examples = [{ input: { content: '' }, output: { content: '' } }];
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
@@ -86,7 +86,7 @@ function GoogleOptions() {
}
current.pop();
update.examples = current;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
diff --git a/client/src/components/Input/NewConversationMenu/EndpointItem.jsx b/client/src/components/Input/NewConversationMenu/EndpointItem.jsx
index 97852e087d..5d03a0a29e 100644
--- a/client/src/components/Input/NewConversationMenu/EndpointItem.jsx
+++ b/client/src/components/Input/NewConversationMenu/EndpointItem.jsx
@@ -37,7 +37,7 @@ export default function ModelItem({ endpoint, value, onSelect }) {
>
{icon}
{alternateName[endpoint] || endpoint}
- {!!['azureOpenAI', 'openAI'].find(e => e === endpoint) && <sup>$</sup>}
+ {!!['azureOpenAI', 'openAI'].find((e) => e === endpoint) && <sup>$</sup>}
<div className="flex w-4 flex-1" />
{isUserProvided ? (
<button
diff --git a/client/src/components/Input/NewConversationMenu/EndpointItems.jsx b/client/src/components/Input/NewConversationMenu/EndpointItems.jsx
index 94c1ffbb8b..cc9e008ebe 100644
--- a/client/src/components/Input/NewConversationMenu/EndpointItems.jsx
+++ b/client/src/components/Input/NewConversationMenu/EndpointItems.jsx
@@ -4,7 +4,7 @@ import EndpointItem from './EndpointItem.jsx';
export default function EndpointItems({ endpoints, onSelect }) {
return (
<>
- {endpoints.map(endpoint => (
+ {endpoints.map((endpoint) => (
<EndpointItem key={endpoint} value={endpoint} onSelect={onSelect} endpoint={endpoint} />
))}
</>
diff --git a/client/src/components/Input/NewConversationMenu/PresetItems.jsx b/client/src/components/Input/NewConversationMenu/PresetItems.jsx
index 1951861cf4..58f949ae72 100644
--- a/client/src/components/Input/NewConversationMenu/PresetItems.jsx
+++ b/client/src/components/Input/NewConversationMenu/PresetItems.jsx
@@ -4,7 +4,7 @@ import PresetItem from './PresetItem.jsx';
export default function PresetItems({ presets, onSelect, onChangePreset, onDeletePreset }) {
return (
<>
- {presets.map(preset => (
+ {presets.map((preset) => (
<PresetItem
key={preset?.presetId}
value={preset}
diff --git a/client/src/components/Input/NewConversationMenu/index.jsx b/client/src/components/Input/NewConversationMenu/index.jsx
index 7d9260d403..2b1fae199d 100644
--- a/client/src/components/Input/NewConversationMenu/index.jsx
+++ b/client/src/components/Input/NewConversationMenu/index.jsx
@@ -61,7 +61,7 @@ export default function NewConversationMenu() {
// update the default model when availableModels changes
// typically, availableModels changes => modelsFilter or customGPTModels changes
useEffect(() => {
- const isInvalidConversation = !availableEndpoints.find(e => e === endpoint);
+ const isInvalidConversation = !availableEndpoints.find((e) => e === endpoint);
if (conversationId == 'new' && isInvalidConversation) {
newConversation();
}
@@ -135,7 +135,7 @@ export default function NewConversationMenu() {
</DropdownMenuTrigger>
<DropdownMenuContent
className="min-w-[300px] dark:bg-gray-700"
- onCloseAutoFocus={event => event.preventDefault()}
+ onCloseAutoFocus={(event) => event.preventDefault()}
>
<DropdownMenuLabel className="dark:text-gray-300">Select an Endpoint</DropdownMenuLabel>
<DropdownMenuSeparator />
@@ -156,7 +156,7 @@ export default function NewConversationMenu() {
<div className="mt-6 w-full" />
<DropdownMenuLabel className="flex items-center dark:text-gray-300">
- <span className="cursor-pointer" onClick={() => setShowPresets(prev => !prev)}>
+ <span className="cursor-pointer" onClick={() => setShowPresets((prev) => !prev)}>
{showPresets ? 'Hide ' : 'Show '} Presets
</span>
<div className="flex-1" />
diff --git a/client/src/components/Input/OpenAIOptions/index.jsx b/client/src/components/Input/OpenAIOptions/index.jsx
index ea75bef822..742e726729 100644
--- a/client/src/components/Input/OpenAIOptions/index.jsx
+++ b/client/src/components/Input/OpenAIOptions/index.jsx
@@ -33,7 +33,7 @@ function OpenAIOptions() {
const models = endpointsConfig?.['openAI']?.['availableModels'] || [];
- const triggerAdvancedMode = () => setAdvancedMode(prev => !prev);
+ const triggerAdvancedMode = () => setAdvancedMode((prev) => !prev);
const switchToSimpleMode = () => {
setAdvancedMode(false);
@@ -43,10 +43,10 @@ function OpenAIOptions() {
setSaveAsDialogShow(true);
};
- const setOption = param => (newValue) => {
+ const setOption = (param) => (newValue) => {
let update = {};
update[param] = newValue;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...update
}));
diff --git a/client/src/components/Input/SetTokenDialog/index.jsx b/client/src/components/Input/SetTokenDialog/index.jsx
index eec1fedadc..197f034362 100644
--- a/client/src/components/Input/SetTokenDialog/index.jsx
+++ b/client/src/components/Input/SetTokenDialog/index.jsx
@@ -176,7 +176,7 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
<InputWithLabel
id={'chatGPTLabel'}
value={token || ''}
- onChange={e => setToken(e.target.value || '')}
+ onChange={(e) => setToken(e.target.value || '')}
label={'OpenAI API Key'}
/>
</>
@@ -185,28 +185,28 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
<InputWithLabel
id={'instanceNameLabel'}
value={getAzure('instanceName') || ''}
- onChange={e => setAzure('instanceName', e.target.value || '')}
+ onChange={(e) => setAzure('instanceName', e.target.value || '')}
label={'Azure OpenAI Instance Name'}
/>
<InputWithLabel
id={'deploymentNameLabel'}
value={getAzure('deploymentName') || ''}
- onChange={e => setAzure('deploymentName', e.target.value || '')}
+ onChange={(e) => setAzure('deploymentName', e.target.value || '')}
label={'Azure OpenAI Deployment Name'}
/>
<InputWithLabel
id={'versionLabel'}
value={getAzure('version') || ''}
- onChange={e => setAzure('version', e.target.value || '')}
+ onChange={(e) => setAzure('version', e.target.value || '')}
label={'Azure OpenAI API Version'}
/>
<InputWithLabel
id={'apiKeyLabel'}
value={getAzure('apiKey') || ''}
- onChange={e => setAzure('apiKey', e.target.value || '')}
+ onChange={(e) => setAzure('apiKey', e.target.value || '')}
label={'Azure OpenAI API Key'}
/>
</>
@@ -236,7 +236,7 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
<InputWithLabel
id={'chatGPTLabel'}
value={token || ''}
- onChange={e => setToken(e.target.value || '')}
+ onChange={(e) => setToken(e.target.value || '')}
label={'Token Name'}
/>
</>
diff --git a/client/src/components/Input/index.jsx b/client/src/components/Input/index.jsx
index fd2bf206cd..bd9b6eb4df 100644
--- a/client/src/components/Input/index.jsx
+++ b/client/src/components/Input/index.jsx
@@ -128,7 +128,7 @@ export default function TextChat({ isSearchView = false }) {
};
const handleBingToneSetting = () => {
- setShowBingToneSetting(show => !show);
+ setShowBingToneSetting((show) => !show);
};
if (isSearchView) return <></>;
diff --git a/client/src/components/MessageHandler/index.jsx b/client/src/components/MessageHandler/index.jsx
index 4adf93a58a..dda9cf8a3d 100644
--- a/client/src/components/MessageHandler/index.jsx
+++ b/client/src/components/MessageHandler/index.jsx
@@ -72,7 +72,7 @@ export default function MessageHandler() {
}, 5000);
}
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...conversation
}));
@@ -104,7 +104,7 @@ export default function MessageHandler() {
]);
const { conversationId } = message;
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
conversationId
}));
@@ -133,7 +133,7 @@ export default function MessageHandler() {
}, 5000);
}
- setConversation(prevState => ({
+ setConversation((prevState) => ({
...prevState,
...conversation
}));
@@ -167,7 +167,7 @@ export default function MessageHandler() {
abortKey: conversationId
})
})
- .then(response => response.json())
+ .then((response) => response.json())
.then((data) => {
console.log('aborted', data);
cancelHandler(data, submission);
diff --git a/client/src/components/Messages/HoverButtons.jsx b/client/src/components/Messages/HoverButtons.jsx
index 465d51aa5b..d7755e7aba 100644
--- a/client/src/components/Messages/HoverButtons.jsx
+++ b/client/src/components/Messages/HoverButtons.jsx
@@ -18,7 +18,7 @@ export default function HoverButtons({
const branchingSupported =
// azureOpenAI, openAI, chatGPTBrowser support branching, so edit enabled
- !!['azureOpenAI', 'openAI', 'chatGPTBrowser', 'google'].find(e => e === endpoint) ||
+ !!['azureOpenAI', 'openAI', 'chatGPTBrowser', 'google'].find((e) => e === endpoint) ||
// Sydney in bingAI supports branching, so edit enabled
(endpoint === 'bingAI' && jailbreak);
diff --git a/client/src/components/Messages/Message.jsx b/client/src/components/Messages/Message.jsx
index 1d4bbbd1bf..223804f5d9 100644
--- a/client/src/components/Messages/Message.jsx
+++ b/client/src/components/Messages/Message.jsx
@@ -63,7 +63,7 @@ export default function Message({
}
}, [last, message]);
- const enterEdit = cancel => setCurrentEditId(cancel ? -1 : message.messageId);
+ const enterEdit = (cancel) => setCurrentEditId(cancel ? -1 : message.messageId);
const handleWheel = () => {
if (blinker) {
diff --git a/client/src/components/Messages/MultiMessage.jsx b/client/src/components/Messages/MultiMessage.jsx
index 42130332be..ded5c3c407 100644
--- a/client/src/components/Messages/MultiMessage.jsx
+++ b/client/src/components/Messages/MultiMessage.jsx
@@ -41,7 +41,7 @@ export default function MultiMessage({
return (
<>
{messagesTree
- ? messagesTree.map(message => (
+ ? messagesTree.map((message) => (
<Message
key={message.messageId}
conversation={conversation}
diff --git a/client/src/components/Nav/ExportConversation/ExportModel.jsx b/client/src/components/Nav/ExportConversation/ExportModel.jsx
index 41d5452955..a91daeecdb 100644
--- a/client/src/components/Nav/ExportConversation/ExportModel.jsx
+++ b/client/src/components/Nav/ExportConversation/ExportModel.jsx
@@ -31,7 +31,7 @@ export default function ExportModel({ open, onOpenChange }) {
const getSiblingIdx = useRecoilCallback(
({ snapshot }) =>
- async messageId =>
+ async (messageId) =>
await snapshot.getPromise(store.messagesSiblingIdxFamily(messageId)),
[]
);
@@ -142,39 +142,39 @@ export default function ExportModel({ open, onOpenChange }) {
fileName: filename,
extension: 'csv',
exportType: exportFromJSON.types.csv,
- beforeTableEncode: entries => [
+ beforeTableEncode: (entries) => [
{
fieldName: 'sender',
- fieldValues: entries.find(e => e.fieldName == 'sender').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'sender').fieldValues
},
- { fieldName: 'text', fieldValues: entries.find(e => e.fieldName == 'text').fieldValues },
+ { fieldName: 'text', fieldValues: entries.find((e) => e.fieldName == 'text').fieldValues },
{
fieldName: 'isCreatedByUser',
- fieldValues: entries.find(e => e.fieldName == 'isCreatedByUser').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'isCreatedByUser').fieldValues
},
{
fieldName: 'error',
- fieldValues: entries.find(e => e.fieldName == 'error').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'error').fieldValues
},
{
fieldName: 'unfinished',
- fieldValues: entries.find(e => e.fieldName == 'unfinished').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'unfinished').fieldValues
},
{
fieldName: 'cancelled',
- fieldValues: entries.find(e => e.fieldName == 'cancelled').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'cancelled').fieldValues
},
{
fieldName: 'messageId',
- fieldValues: entries.find(e => e.fieldName == 'messageId').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'messageId').fieldValues
},
{
fieldName: 'parentMessageId',
- fieldValues: entries.find(e => e.fieldName == 'parentMessageId').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'parentMessageId').fieldValues
},
{
fieldName: 'createdAt',
- fieldValues: entries.find(e => e.fieldName == 'createdAt').fieldValues
+ fieldValues: entries.find((e) => e.fieldName == 'createdAt').fieldValues
}
]
});
@@ -322,7 +322,7 @@ export default function ExportModel({ open, onOpenChange }) {
<Input
id="filename"
value={filename}
- onChange={e => setFileName(filenamify(e.target.value || ''))}
+ onChange={(e) => setFileName(filenamify(e.target.value || ''))}
placeholder="Set the filename"
className={cn(
defaultTextProps,
diff --git a/client/src/components/Nav/MobileNav.jsx b/client/src/components/Nav/MobileNav.jsx
index d00f3d02e7..c619588ad5 100644
--- a/client/src/components/Nav/MobileNav.jsx
+++ b/client/src/components/Nav/MobileNav.jsx
@@ -13,7 +13,7 @@ export default function MobileNav({ setNavVisible }) {
<button
type="button"
className="-ml-0.5 -mt-0.5 inline-flex h-10 w-10 items-center justify-center rounded-md hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white dark:hover:text-white"
- onClick={() => setNavVisible(prev => !prev)}
+ onClick={() => setNavVisible((prev) => !prev)}
>
<span className="sr-only">Open sidebar</span>
<svg
diff --git a/client/src/components/Nav/SearchBar.jsx b/client/src/components/Nav/SearchBar.jsx
index da35555560..4af3e7c177 100644
--- a/client/src/components/Nav/SearchBar.jsx
+++ b/client/src/components/Nav/SearchBar.jsx
@@ -20,7 +20,7 @@ export default function SearchBar({ clearSearch }) {
type="text"
className="m-0 mr-0 w-full border-none bg-transparent p-0 text-sm leading-tight outline-none"
value={searchQuery}
- onChange={e => setSearchQuery(e.target.value)}
+ onChange={(e) => setSearchQuery(e.target.value)}
placeholder="Search messages"
onKeyUp={handleKeyUp}
/>
diff --git a/client/src/components/Nav/index.jsx b/client/src/components/Nav/index.jsx
index 4fc50ab03c..24af4b7534 100644
--- a/client/src/components/Nav/index.jsx
+++ b/client/src/components/Nav/index.jsx
@@ -119,7 +119,7 @@ export default function Nav({ navVisible, setNavVisible }) {
};
const toggleNavVisible = () => {
- setNavVisible(prev => !prev);
+ setNavVisible((prev) => !prev);
};
useEffect(() => {
diff --git a/client/src/components/ui/Dropdown.jsx b/client/src/components/ui/Dropdown.jsx
index 75d93c2015..9c7b1fdf5c 100644
--- a/client/src/components/ui/Dropdown.jsx
+++ b/client/src/components/ui/Dropdown.jsx
@@ -5,7 +5,7 @@ import { cn } from '~/utils/';
function Dropdown({ value, onChange, options, className, containerClassName }) {
const currentOption =
- options.find(element => element === value || element?.value === value) ?? value;
+ options.find((element) => element === value || element?.value === value) ?? value;
return (
<div className={cn('flex items-center justify-center gap-2', containerClassName)}>
<div className="relative w-full">
diff --git a/client/src/components/ui/ModelSelect.jsx b/client/src/components/ui/ModelSelect.jsx
index 8835aea239..4a0ed8482f 100644
--- a/client/src/components/ui/ModelSelect.jsx
+++ b/client/src/components/ui/ModelSelect.jsx
@@ -22,12 +22,12 @@ const ModelSelect = ({ model, onChange, availableModels, ...props }) => {
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-56 dark:bg-gray-700"
- onCloseAutoFocus={event => event.preventDefault()}
+ onCloseAutoFocus={(event) => event.preventDefault()}
>
<DropdownMenuLabel className="dark:text-gray-300">Select a model</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuRadioGroup value={model} onValueChange={onChange} className="overflow-y-auto">
- {availableModels.map(model => (
+ {availableModels.map((model) => (
<DropdownMenuRadioItem
key={model}
value={model}
diff --git a/client/src/store/conversations.js b/client/src/store/conversations.js
index 4747171922..bc2c91daff 100644
--- a/client/src/store/conversations.js
+++ b/client/src/store/conversations.js
@@ -16,7 +16,7 @@ const refreshConversationsHint = atom({
const useConversations = () => {
const setRefreshConversationsHint = useSetRecoilState(refreshConversationsHint);
- const refreshConversations = () => setRefreshConversationsHint(prevState => prevState + 1);
+ const refreshConversations = () => setRefreshConversationsHint((prevState) => prevState + 1);
return { refreshConversations };
};
diff --git a/client/src/store/endpoints.js b/client/src/store/endpoints.js
index 9b0ddae97b..383127c094 100644
--- a/client/src/store/endpoints.js
+++ b/client/src/store/endpoints.js
@@ -27,7 +27,7 @@ const availableEndpoints = selector({
get: ({ get }) => {
const endpoints = ['azureOpenAI', 'openAI', 'chatGPTBrowser', 'bingAI', 'google'];
const f = get(endpointsFilter);
- return endpoints.filter(endpoint => f[endpoint]);
+ return endpoints.filter((endpoint) => f[endpoint]);
}
});
// const modelAvailable
diff --git a/client/src/store/token.js b/client/src/store/token.js
index c058d784e8..a9989599ce 100644
--- a/client/src/store/token.js
+++ b/client/src/store/token.js
@@ -10,7 +10,7 @@ const useToken = (endpoint) => {
const getToken = () => localStorage.getItem(`${endpoint}_token`);
const saveToken = (value) => {
localStorage.setItem(`${endpoint}_token`, value);
- setHints(prev => prev + 1);
+ setHints((prev) => prev + 1);
};
return { token: getToken(), getToken, saveToken };
diff --git a/client/src/utils/getDefaultConversation.js b/client/src/utils/getDefaultConversation.js
index 287aa74796..18710cc19d 100644
--- a/client/src/utils/getDefaultConversation.js
+++ b/client/src/utils/getDefaultConversation.js
@@ -128,7 +128,7 @@ const getDefaultConversation = ({ conversation, prevConversation, endpointsConfi
// if anything happens, reset to default model
const endpoint = ['openAI', 'azureOpenAI', 'bingAI', 'chatGPTBrowser', 'google'].find(
- e => endpointsConfig?.[e]
+ (e) => endpointsConfig?.[e]
);
if (endpoint) {
conversation = buildDefaultConversation({ conversation, endpoint, endpointsConfig });
diff --git a/client/src/utils/handleSubmit.js b/client/src/utils/handleSubmit.js
index 09812542b6..9964f6845a 100644
--- a/client/src/utils/handleSubmit.js
+++ b/client/src/utils/handleSubmit.js
@@ -159,7 +159,7 @@ const useMessageHandler = () => {
};
const regenerate = ({ parentMessageId }) => {
- const parentMessage = messages?.find(element => element.messageId == parentMessageId);
+ const parentMessage = messages?.find((element) => element.messageId == parentMessageId);
if (parentMessage && parentMessage.isCreatedByUser)
ask({ ...parentMessage }, { isRegenerate: true });