ci(backend-review.yml): add linter step to the backend review workflow (#625)

* ci(backend-review.yml): add linter step to the backend review workflow

* chore(backend-review.yml): remove prettier from lint-action configuration

* chore: apply new linting workflow

* chore(lint-staged.config.js): reorder lint-staged tasks for JavaScript and TypeScript files

* chore(eslint): update ignorePatterns in .eslintrc.js
chore(lint-action): remove prettier option in backend-review.yml
chore(package.json): add lint and lint:fix scripts

* chore(lint-staged.config.js): remove prettier --write command for js, jsx, ts, tsx files

* chore(titleConvo.js): remove unnecessary console.log statement
chore(titleConvo.js): add missing comma in options object

* chore: apply linting to all files

* chore(lint-staged.config.js): update lint-staged configuration to include prettier formatting
This commit is contained in:
Danny Avila 2023-07-14 09:36:49 -04:00 committed by GitHub
parent 637bb6bc11
commit e5336039fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
231 changed files with 1688 additions and 1526 deletions

View file

@ -13,7 +13,7 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
top_p: _preset?.top_p ?? 1,
presence_penalty: _preset?.presence_penalty ?? 0,
frequency_penalty: _preset?.frequency_penalty ?? 0,
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else if (endpoint === 'google') {
preset = {
@ -27,7 +27,7 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
maxOutputTokens: _preset?.maxOutputTokens ?? 1024,
topP: _preset?.topP ?? 0.95,
topK: _preset?.topK ?? 40,
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else if (endpoint === 'anthropic') {
preset = {
@ -40,7 +40,7 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
maxOutputTokens: _preset?.maxOutputTokens ?? 1024,
topP: _preset?.topP ?? 0.7,
topK: _preset?.topK ?? 40,
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else if (endpoint === 'bingAI') {
preset = {
@ -50,7 +50,7 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
context: _preset?.context ?? null,
systemMessage: _preset?.systemMessage ?? null,
toneStyle: _preset?.toneStyle ?? 'creative',
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else if (endpoint === 'chatGPTBrowser') {
preset = {
@ -60,7 +60,7 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
_preset?.model ??
endpointsConfig[endpoint]?.availableModels?.[0] ??
'text-davinci-002-render-sha',
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else if (endpoint === 'gptPlugins') {
const agentOptions = _preset?.agentOptions ?? {
@ -84,20 +84,20 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
presence_penalty: _preset?.presence_penalty ?? 0,
frequency_penalty: _preset?.frequency_penalty ?? 0,
agentOptions,
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else if (endpoint === null) {
preset = {
endpoint,
presetId: _preset?.presetId || null,
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
} else {
console.error(`Unknown endpoint ${endpoint}`);
preset = {
endpoint: null,
presetId: _preset?.presetId ?? null,
title: _preset?.title ?? 'New Preset'
title: _preset?.title ?? 'New Preset',
};
}

View file

@ -2,7 +2,7 @@ const buildDefaultConversation = ({
conversation,
endpoint,
endpointsConfig = {},
lastConversationSetup = {}
lastConversationSetup = {},
}) => {
const lastSelectedModel = JSON.parse(localStorage.getItem('lastSelectedModel')) || {};
const lastSelectedTools = JSON.parse(localStorage.getItem('lastSelectedTools')) || [];
@ -22,7 +22,7 @@ const buildDefaultConversation = ({
temperature: lastConversationSetup?.temperature ?? 1,
top_p: lastConversationSetup?.top_p ?? 1,
presence_penalty: lastConversationSetup?.presence_penalty ?? 0,
frequency_penalty: lastConversationSetup?.frequency_penalty ?? 0
frequency_penalty: lastConversationSetup?.frequency_penalty ?? 0,
};
} else if (endpoint === 'google') {
conversation = {
@ -36,12 +36,12 @@ const buildDefaultConversation = ({
modelLabel: lastConversationSetup?.modelLabel ?? null,
promptPrefix: lastConversationSetup?.promptPrefix ?? null,
examples: lastConversationSetup?.examples ?? [
{ input: { content: '' }, output: { content: '' } }
{ input: { content: '' }, output: { content: '' } },
],
temperature: lastConversationSetup?.temperature ?? 0.2,
maxOutputTokens: lastConversationSetup?.maxOutputTokens ?? 1024,
topP: lastConversationSetup?.topP ?? 0.95,
topK: lastConversationSetup?.topK ?? 40
topK: lastConversationSetup?.topK ?? 40,
};
} else if (endpoint === 'bingAI') {
const { jailbreak, toneStyle } = lastBingSettings;
@ -55,7 +55,7 @@ const buildDefaultConversation = ({
jailbreakConversationId: lastConversationSetup?.jailbreakConversationId ?? null,
conversationSignature: null,
clientId: null,
invocationId: 1
invocationId: 1,
};
} else if (endpoint === 'anthropic') {
conversation = {
@ -71,7 +71,7 @@ const buildDefaultConversation = ({
temperature: lastConversationSetup?.temperature ?? 0.7,
maxOutputTokens: lastConversationSetup?.maxOutputTokens ?? 1024,
topP: lastConversationSetup?.topP ?? 0.7,
topK: lastConversationSetup?.topK ?? 40
topK: lastConversationSetup?.topK ?? 40,
};
} else if (endpoint === 'chatGPTBrowser') {
conversation = {
@ -81,7 +81,7 @@ const buildDefaultConversation = ({
lastConversationSetup?.model ??
lastSelectedModel[endpoint] ??
endpointsConfig[endpoint]?.availableModels?.[0] ??
'text-davinci-002-render-sha'
'text-davinci-002-render-sha',
};
} else if (endpoint === 'gptPlugins') {
const agentOptions = lastConversationSetup?.agentOptions ?? {
@ -108,18 +108,18 @@ const buildDefaultConversation = ({
top_p: lastConversationSetup?.top_p ?? 1,
presence_penalty: lastConversationSetup?.presence_penalty ?? 0,
frequency_penalty: lastConversationSetup?.frequency_penalty ?? 0,
agentOptions
agentOptions,
};
} else if (endpoint === null) {
conversation = {
...conversation,
endpoint
endpoint,
};
} else {
console.error(`Unknown endpoint ${endpoint}`);
conversation = {
...conversation,
endpoint: null
endpoint: null,
};
}
@ -137,7 +137,7 @@ const getDefaultConversation = ({ conversation, endpointsConfig, preset }) => {
conversation,
endpoint,
lastConversationSetup: preset,
endpointsConfig
endpointsConfig,
});
return conversation;
} else {
@ -182,7 +182,7 @@ const getDefaultConversation = ({ conversation, endpointsConfig, preset }) => {
'chatGPTBrowser',
'gptPlugins',
'google',
'anthropic'
'anthropic',
].find((e) => endpointsConfig?.[e]);
if (endpoint) {
conversation = buildDefaultConversation({ conversation, endpoint, endpointsConfig });

View file

@ -13,7 +13,7 @@ const getIcon = (props) => {
title={user?.name || 'User'}
style={{
width: size,
height: size
height: size,
}}
className={'relative flex items-center justify-center' + props?.className}
>
@ -93,7 +93,7 @@ const getIcon = (props) => {
style={{
background: bg || 'transparent',
width: size,
height: size
height: size,
}}
className={cn(
'relative flex items-center justify-center rounded-sm text-white ',

View file

@ -17,7 +17,7 @@ const useMessageHandler = () => {
const ask = (
{ text, parentMessageId = null, conversationId = null, messageId = null },
{ isRegenerate = false } = {}
{ isRegenerate = false } = {},
) => {
if (!!isSubmitting || text === '') {
return;
@ -40,7 +40,7 @@ const useMessageHandler = () => {
top_p: currentConversation?.top_p ?? 1,
presence_penalty: currentConversation?.presence_penalty ?? 0,
frequency_penalty: currentConversation?.frequency_penalty ?? 0,
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null,
};
responseSender = endpointOption.chatGptLabel ?? 'ChatGPT';
} else if (endpoint === 'google') {
@ -53,13 +53,13 @@ const useMessageHandler = () => {
modelLabel: currentConversation?.modelLabel ?? null,
promptPrefix: currentConversation?.promptPrefix ?? null,
examples: currentConversation?.examples ?? [
{ input: { content: '' }, output: { content: '' } }
{ input: { content: '' }, output: { content: '' } },
],
temperature: currentConversation?.temperature ?? 0.2,
maxOutputTokens: currentConversation?.maxOutputTokens ?? 1024,
topP: currentConversation?.topP ?? 0.95,
topK: currentConversation?.topK ?? 40,
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null,
};
responseSender = endpointOption.chatGptLabel ?? 'ChatGPT';
} else if (endpoint === 'bingAI') {
@ -73,7 +73,7 @@ const useMessageHandler = () => {
conversationSignature: currentConversation?.conversationSignature ?? null,
clientId: currentConversation?.clientId ?? null,
invocationId: currentConversation?.invocationId ?? 1,
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null,
};
responseSender = endpointOption.jailbreak ? 'Sydney' : 'BingAI';
} else if (endpoint === 'anthropic') {
@ -89,7 +89,7 @@ const useMessageHandler = () => {
maxOutputTokens: currentConversation?.maxOutputTokens ?? 1024,
topP: currentConversation?.topP ?? 0.7,
topK: currentConversation?.topK ?? 40,
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null,
};
responseSender = 'Anthropic';
} else if (endpoint === 'chatGPTBrowser') {
@ -99,7 +99,7 @@ const useMessageHandler = () => {
currentConversation?.model ??
endpointsConfig[endpoint]?.availableModels?.[0] ??
'text-davinci-002-render-sha',
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null,
};
responseSender = 'ChatGPT';
} else if (endpoint === 'gptPlugins') {
@ -123,7 +123,7 @@ const useMessageHandler = () => {
presence_penalty: currentConversation?.presence_penalty ?? 0,
frequency_penalty: currentConversation?.frequency_penalty ?? 0,
token: endpointsConfig[endpoint]?.userProvide ? getToken() : null,
agentOptions
agentOptions,
};
responseSender = 'ChatGPT';
} else if (endpoint === null) {
@ -159,7 +159,7 @@ const useMessageHandler = () => {
isCreatedByUser: true,
parentMessageId,
conversationId,
messageId: fakeMessageId
messageId: fakeMessageId,
};
// construct the placeholder response message
@ -170,22 +170,22 @@ const useMessageHandler = () => {
messageId: (isRegenerate ? messageId : fakeMessageId) + '_',
conversationId,
unfinished: endpoint === 'azureOpenAI' || endpoint === 'openAI' ? false : true,
submitting: true
submitting: true,
};
const submission = {
conversation: {
...currentConversation,
conversationId
conversationId,
},
endpointOption,
message: {
...currentMsg,
overrideParentMessageId: isRegenerate ? messageId : null
overrideParentMessageId: isRegenerate ? messageId : null,
},
messages: currentMessages,
isRegenerate,
initialResponse
initialResponse,
};
console.log('User Input:', text, submission);
@ -205,7 +205,7 @@ const useMessageHandler = () => {
ask({ ...parentMessage }, { isRegenerate: true });
else
console.error(
'Failed to regenerate the message: parentMessage not found or not created by user.'
'Failed to regenerate the message: parentMessage not found or not created by user.',
);
};

View file

@ -32,7 +32,7 @@ export const languages = [
'x86asm',
'matlab',
'perl',
'pascal'
'pascal',
];
export const alternateName = {

View file

@ -13,7 +13,7 @@ export default function resetConvo(messages, sender) {
'last model: ',
lastModel,
'sender: ',
sender
sender,
);
return true;
}