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

@ -6,7 +6,7 @@ import {
atomFamily,
useSetRecoilState,
useResetRecoilState,
useRecoilCallback
useRecoilCallback,
} from 'recoil';
import buildTree from '~/utils/buildTree';
import getDefaultConversation from '~/utils/getDefaultConversation';
@ -14,7 +14,7 @@ import submission from './submission.js';
const conversation = atom({
key: 'conversation',
default: null
default: null,
});
// current messages of the conversation, must be an array
@ -22,24 +22,24 @@ const conversation = atom({
// [{text, sender, messageId, parentMessageId, isCreatedByUser}]
const messages = atom({
key: 'messages',
default: []
default: [],
});
const messagesTree = selector({
key: 'messagesTree',
get: ({ get }) => {
return buildTree(get(messages), false);
}
},
});
const latestMessage = atom({
key: 'latestMessage',
default: null
default: null,
});
const messagesSiblingIdxFamily = atomFamily({
key: 'messagesSiblingIdx',
default: 0
default: 0,
});
const useConversation = () => {
@ -52,7 +52,7 @@ const useConversation = () => {
conversation,
messages = null,
preset = null,
{ endpointsConfig = {}, prevConversation = {} }
{ endpointsConfig = {}, prevConversation = {} },
) => {
let { endpoint = null } = conversation;
@ -62,7 +62,7 @@ const useConversation = () => {
conversation,
endpointsConfig,
prevConversation,
preset
preset,
});
setConversation(conversation);
@ -78,10 +78,10 @@ const useConversation = () => {
const endpointsConfig = await snapshot.getPromise(endpoints.endpointsConfig);
_switchToConversation(_conversation, messages, preset, {
endpointsConfig,
prevConversation
prevConversation,
});
},
[]
[],
);
const newConversation = useCallback((template = {}, preset) => {
@ -89,10 +89,10 @@ const useConversation = () => {
{
conversationId: 'new',
title: 'New Chat',
...template
...template,
},
[],
preset
preset,
);
}, [switchToConversation]);
@ -100,9 +100,9 @@ const useConversation = () => {
switchToConversation(
{
conversationId: 'search',
title: 'Search'
title: 'Search',
},
[]
[],
);
};
@ -115,5 +115,5 @@ export default {
messagesTree,
latestMessage,
messagesSiblingIdxFamily,
useConversation
useConversation,
};

View file

@ -3,7 +3,7 @@ import { useCallback } from 'react';
const refreshConversationsHint = atom({
key: 'refreshConversationsHint',
default: 1
default: 1,
});
const useConversations = () => {

View file

@ -9,8 +9,8 @@ const endpointsConfig = atom({
chatGPTBrowser: null,
gptPlugins: null,
google: null,
anthropic: null
}
anthropic: null,
},
});
const endpointsFilter = selector({
@ -21,7 +21,7 @@ const endpointsFilter = selector({
let filter = {};
for (const key of Object.keys(config)) filter[key] = !!config[key];
return filter;
}
},
});
const availableEndpoints = selector({
@ -30,12 +30,12 @@ const availableEndpoints = selector({
const endpoints = ['azureOpenAI', 'openAI', 'chatGPTBrowser', 'gptPlugins', 'bingAI', 'google', 'anthropic'];
const f = get(endpointsFilter);
return endpoints.filter((endpoint) => f[endpoint]);
}
},
});
// const modelAvailable
export default {
endpointsConfig,
endpointsFilter,
availableEndpoints
availableEndpoints,
};

View file

@ -19,5 +19,5 @@ export default {
...search,
...preset,
...token,
...lang
...lang,
};

View file

@ -2,7 +2,7 @@ import { atom } from 'recoil';
const lang = atom({
key: 'lang',
default: 'en'
default: 'en',
});
export default { lang };

View file

@ -7,9 +7,9 @@ import { atom } from 'recoil';
// [preset1, preset2, preset3]
const presets = atom({
key: 'presets',
default: []
default: [],
});
export default {
presets
presets,
};

View file

@ -3,24 +3,24 @@ import buildTree from '~/utils/buildTree';
const isSearchEnabled = atom({
key: 'isSearchEnabled',
default: null
default: null,
});
const searchQuery = atom({
key: 'searchQuery',
default: ''
default: '',
});
const searchResultMessages = atom({
key: 'searchResultMessages',
default: null
default: null,
});
const searchResultMessagesTree = selector({
key: 'searchResultMessagesTree',
get: ({ get }) => {
return buildTree(get(searchResultMessages), true);
}
},
});
const isSearching = selector({
@ -28,7 +28,7 @@ const isSearching = selector({
get: ({ get }) => {
const data = get(searchQuery);
return !!data;
}
},
});
export default {
@ -36,5 +36,5 @@ export default {
isSearching,
searchResultMessages,
searchResultMessagesTree,
searchQuery
searchQuery,
};

View file

@ -13,15 +13,15 @@ import { atom } from 'recoil';
const submission = atom({
key: 'submission',
default: null
default: null,
});
const isSubmitting = atom({
key: 'isSubmitting',
default: false
default: false,
});
export default {
submission,
isSubmitting
isSubmitting,
};

View file

@ -2,7 +2,7 @@ import { atom } from 'recoil';
const text = atom({
key: 'text',
default: ''
default: '',
});
export default { text };

View file

@ -2,7 +2,7 @@ import { atom, useRecoilState } from 'recoil';
const tokenRefreshHints = atom({
key: 'tokenRefreshHints',
default: 1
default: 1,
});
const useToken = (endpoint) => {
@ -18,5 +18,5 @@ const useToken = (endpoint) => {
};
export default {
useToken
useToken,
};

View file

@ -2,9 +2,9 @@ import { atom } from 'recoil';
const user = atom({
key: 'user',
default: null
default: null,
});
export default {
user
user,
};