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

@ -8,7 +8,7 @@ const {
sendMessage,
createOnProgress,
formatSteps,
formatAction
formatAction,
} = require('./handlers');
const requireJwtAuth = require('../../../middleware/requireJwtAuth');
@ -44,12 +44,12 @@ router.post('/', requireJwtAuth, async (req, res) => {
temperature: req.body?.temperature ?? 0,
top_p: req.body?.top_p ?? 1,
presence_penalty: req.body?.presence_penalty ?? 0,
frequency_penalty: req.body?.frequency_penalty ?? 0
frequency_penalty: req.body?.frequency_penalty ?? 0,
},
agentOptions: {
...agentOptions,
// agent: 'functions'
}
},
};
console.log('ask log');
@ -63,7 +63,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
conversationId,
parentMessageId,
req,
res
res,
});
});
@ -73,7 +73,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
'Access-Control-Allow-Origin': '*',
'X-Accel-Buffering': 'no'
'X-Accel-Buffering': 'no',
});
let userMessage;
let userMessageId;
@ -87,7 +87,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
loading: true,
inputs: [],
latest: null,
outputs: null
outputs: null,
};
try {
@ -119,10 +119,10 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
model: endpointOption.modelOptions.model,
unfinished: true,
cancelled: false,
error: false
error: false,
});
}
}
},
});
const abortController = new AbortController();
@ -149,7 +149,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
final: true,
conversation: await getConvo(req.user.id, conversationId),
requestMessage: userMessage,
responseMessage: responseMessage
responseMessage: responseMessage,
};
};
@ -164,7 +164,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
endpoint,
reverseProxyUrl: process.env.OPENAI_REVERSE_PROXY || null,
proxy: process.env.PROXY || null,
...endpointOption
...endpointOption,
};
let openAIApiKey = req.body?.token ?? process.env.OPENAI_API_KEY;
@ -211,9 +211,9 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
res,
text,
plugin,
parentMessageId: overrideParentMessageId || userMessageId
parentMessageId: overrideParentMessageId || userMessageId,
}),
abortController
abortController,
});
if (overrideParentMessageId) {
@ -230,7 +230,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
final: true,
conversation: await getConvo(req.user.id, conversationId),
requestMessage: userMessage,
responseMessage: response
responseMessage: response,
});
res.end();
@ -243,7 +243,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
});
await saveConvo(req.user.id, {
conversationId: conversationId,
title
title,
});
}
} catch (error) {
@ -256,7 +256,7 @@ const ask = async ({ text, endpoint, endpointOption, parentMessageId = null, con
unfinished: false,
cancelled: false,
error: true,
text: error.message
text: error.message,
};
await saveMessage(errorMessage);
handleError(res, errorMessage);