mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
* feat: add option to disable titling as well as decide what model to use for OpenAI titling refactor: truncate conversation text so it caps around 200 tokens for titling requests, optimize some of the title prompts * feat: disable bing titling with TITLE_CONVO as well
17 lines
476 B
JavaScript
17 lines
476 B
JavaScript
const { isEnabled } = require('../../../utils');
|
|
const { saveConvo } = require('../../../../models');
|
|
|
|
const addTitle = async (req, { text, response, client }) => {
|
|
const { TITLE_CONVO = 'true' } = process.env ?? {};
|
|
if (!isEnabled(TITLE_CONVO)) {
|
|
return;
|
|
}
|
|
|
|
const title = await client.titleConvo({ text, responseText: response?.text });
|
|
await saveConvo(req.user.id, {
|
|
conversationId: response.conversationId,
|
|
title,
|
|
});
|
|
};
|
|
|
|
module.exports = addTitle;
|