mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
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:
parent
637bb6bc11
commit
e5336039fc
231 changed files with 1688 additions and 1526 deletions
|
|
@ -13,7 +13,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
messageId,
|
||||
overrideParentMessageId = null,
|
||||
parentMessageId,
|
||||
conversationId: oldConversationId
|
||||
conversationId: oldConversationId,
|
||||
} = req.body;
|
||||
if (text.length === 0) return handleError(res, { text: 'Prompt empty or too short' });
|
||||
if (endpoint !== 'bingAI') return handleError(res, { text: 'Illegal request' });
|
||||
|
|
@ -29,7 +29,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
text,
|
||||
parentMessageId: userParentMessageId,
|
||||
conversationId,
|
||||
isCreatedByUser: true
|
||||
isCreatedByUser: true,
|
||||
};
|
||||
|
||||
// build endpoint option
|
||||
|
|
@ -41,7 +41,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
systemMessage: req.body?.systemMessage ?? null,
|
||||
context: req.body?.context ?? null,
|
||||
toneStyle: req.body?.toneStyle ?? 'creative',
|
||||
token: req.body?.token ?? null
|
||||
token: req.body?.token ?? null,
|
||||
};
|
||||
else
|
||||
endpointOption = {
|
||||
|
|
@ -52,13 +52,13 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
clientId: req.body?.clientId ?? null,
|
||||
invocationId: req.body?.invocationId ?? null,
|
||||
toneStyle: req.body?.toneStyle ?? 'creative',
|
||||
token: req.body?.token ?? null
|
||||
token: req.body?.token ?? null,
|
||||
};
|
||||
|
||||
console.log('ask log', {
|
||||
userMessage,
|
||||
endpointOption,
|
||||
conversationId
|
||||
conversationId,
|
||||
});
|
||||
|
||||
if (!overrideParentMessageId) {
|
||||
|
|
@ -67,7 +67,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
...userMessage,
|
||||
...endpointOption,
|
||||
conversationId,
|
||||
endpoint
|
||||
endpoint,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
preSendRequest: true,
|
||||
overrideParentMessageId,
|
||||
req,
|
||||
res
|
||||
res,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ const ask = async ({
|
|||
preSendRequest = true,
|
||||
overrideParentMessageId = null,
|
||||
req,
|
||||
res
|
||||
res,
|
||||
}) => {
|
||||
let { text, parentMessageId: userParentMessageId, messageId: userMessageId } = userMessage;
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ const ask = async ({
|
|||
'Content-Type': 'text/event-stream',
|
||||
'Cache-Control': 'no-cache, no-transform',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'X-Accel-Buffering': 'no'
|
||||
'X-Accel-Buffering': 'no',
|
||||
});
|
||||
|
||||
if (preSendRequest) sendMessage(res, { message: userMessage, created: true });
|
||||
|
|
@ -123,10 +123,10 @@ const ask = async ({
|
|||
text: text,
|
||||
unfinished: true,
|
||||
cancelled: false,
|
||||
error: false
|
||||
error: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
const abortController = new AbortController();
|
||||
let bingConversationId = null;
|
||||
|
|
@ -142,9 +142,9 @@ const ask = async ({
|
|||
onProgress: progressCallback.call(null, {
|
||||
res,
|
||||
text,
|
||||
parentMessageId: overrideParentMessageId || userMessageId
|
||||
parentMessageId: overrideParentMessageId || userMessageId,
|
||||
}),
|
||||
abortController
|
||||
abortController,
|
||||
});
|
||||
|
||||
console.log('BING RESPONSE', response);
|
||||
|
|
@ -173,7 +173,7 @@ const ask = async ({
|
|||
response.details.suggestedResponses.map((s) => s.text),
|
||||
unfinished: false,
|
||||
cancelled: false,
|
||||
error: false
|
||||
error: false,
|
||||
};
|
||||
|
||||
await saveMessage(responseMessage);
|
||||
|
|
@ -199,7 +199,7 @@ const ask = async ({
|
|||
await saveMessage({
|
||||
...userMessage,
|
||||
messageId: userMessageId,
|
||||
newMessageId: newUserMessageId
|
||||
newMessageId: newUserMessageId,
|
||||
});
|
||||
userMessageId = newUserMessageId;
|
||||
|
||||
|
|
@ -208,19 +208,19 @@ const ask = async ({
|
|||
final: true,
|
||||
conversation: await getConvo(req.user.id, conversationId),
|
||||
requestMessage: userMessage,
|
||||
responseMessage: responseMessage
|
||||
responseMessage: responseMessage,
|
||||
});
|
||||
res.end();
|
||||
|
||||
if (userParentMessageId == '00000000-0000-0000-0000-000000000000') {
|
||||
const title = await titleConvoBing({
|
||||
text,
|
||||
response: responseMessage
|
||||
response: responseMessage,
|
||||
});
|
||||
|
||||
await saveConvo(req.user.id, {
|
||||
conversationId: conversationId,
|
||||
title
|
||||
title,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -233,7 +233,7 @@ const ask = async ({
|
|||
unfinished: false,
|
||||
cancelled: false,
|
||||
error: true,
|
||||
text: error.message
|
||||
text: error.message,
|
||||
};
|
||||
await saveMessage(errorMessage);
|
||||
handleError(res, errorMessage);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue