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

@ -32,9 +32,11 @@ class FakeClient extends BaseClient {
this.modelOptions = {
...modelOptions,
model: modelOptions.model || 'gpt-3.5-turbo',
temperature: typeof modelOptions.temperature === 'undefined' ? 0.8 : modelOptions.temperature,
temperature:
typeof modelOptions.temperature === 'undefined' ? 0.8 : modelOptions.temperature,
top_p: typeof modelOptions.top_p === 'undefined' ? 1 : modelOptions.top_p,
presence_penalty: typeof modelOptions.presence_penalty === 'undefined' ? 1 : modelOptions.presence_penalty,
presence_penalty:
typeof modelOptions.presence_penalty === 'undefined' ? 1 : modelOptions.presence_penalty,
stop: modelOptions.stop,
};
}
@ -66,7 +68,7 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
const orderedMessages = TestClient.constructor.getMessagesForConversation(
fakeMessages,
parentMessageId
parentMessageId,
);
TestClient.currentMessages = orderedMessages;
@ -98,7 +100,7 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
this.pastMessages = await TestClient.loadHistory(
conversationId,
TestClient.options?.parentMessageId
TestClient.options?.parentMessageId,
);
const userMessage = {
@ -107,7 +109,7 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
isCreatedByUser: true,
messageId: userMessageId,
parentMessageId,
conversationId
conversationId,
};
const response = {
@ -116,7 +118,7 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
isCreatedByUser: false,
messageId: crypto.randomUUID(),
parentMessageId: userMessage.messageId,
conversationId
conversationId,
};
fakeMessages.push(userMessage);
@ -126,7 +128,7 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
opts.getIds({
userMessage,
conversationId,
responseMessageId: response.messageId
responseMessageId: response.messageId,
});
}
@ -146,7 +148,10 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
// userMessage is always the last one in the payload
if (i === payload.length - 1) {
userMessage.tokenCount = message.tokenCount;
console.debug(`Token count for user message: ${tokenCount}`, `Instruction Tokens: ${tokenCountMap.instructions || 'N/A'}`);
console.debug(
`Token count for user message: ${tokenCount}`,
`Instruction Tokens: ${tokenCountMap.instructions || 'N/A'}`,
);
}
return messageWithoutTokenCount;
});
@ -163,7 +168,10 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
});
TestClient.buildMessages = jest.fn(async (messages, parentMessageId) => {
const orderedMessages = TestClient.constructor.getMessagesForConversation(messages, parentMessageId);
const orderedMessages = TestClient.constructor.getMessagesForConversation(
messages,
parentMessageId,
);
const formattedMessages = orderedMessages.map((message) => {
let { role: _role, sender, text } = message;
const role = _role ?? sender;
@ -180,6 +188,6 @@ const initializeFakeClient = (apiKey, options, fakeMessages) => {
});
return TestClient;
}
};
module.exports = { FakeClient, initializeFakeClient };
module.exports = { FakeClient, initializeFakeClient };