mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-29 22:58:51 +01:00
feat: add additional metadata: endpoint, author ID
This commit is contained in:
parent
fb6e87c36d
commit
84f68f9a15
3 changed files with 14 additions and 4 deletions
|
|
@ -43,7 +43,7 @@ const ten_minutes = 1000 * 60 * 10;
|
|||
* @param {Express.Response} res - The response object, used to send back a response.
|
||||
* @returns {void}
|
||||
*/
|
||||
const chatV2 = async (req, res) => {
|
||||
const chatV1 = async (req, res) => {
|
||||
logger.debug('[/assistants/chat/] req.body', req.body);
|
||||
|
||||
const {
|
||||
|
|
@ -647,4 +647,4 @@ const chatV2 = async (req, res) => {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = chatV2;
|
||||
module.exports = chatV1;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const createAssistant = async (req, res) => {
|
|||
try {
|
||||
const { openai } = await getOpenAIClient({ req, res });
|
||||
|
||||
const { tools = [], endpoint: _e, ...assistantData } = req.body;
|
||||
const { tools = [], endpoint, ...assistantData } = req.body;
|
||||
assistantData.tools = tools
|
||||
.map((tool) => {
|
||||
if (typeof tool !== 'string') {
|
||||
|
|
@ -34,6 +34,11 @@ const createAssistant = async (req, res) => {
|
|||
assistantData.model = openai.locals.azureOptions.azureOpenAIApiDeploymentName;
|
||||
}
|
||||
|
||||
assistantData.metadata = {
|
||||
author: req.user.id,
|
||||
endpoint,
|
||||
};
|
||||
|
||||
const assistant = await openai.beta.assistants.create(assistantData);
|
||||
if (azureModelIdentifier) {
|
||||
assistant.model = azureModelIdentifier;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const createAssistant = async (req, res) => {
|
|||
/** @type {{ openai: OpenAIClient }} */
|
||||
const { openai } = await getOpenAIClient({ req, res });
|
||||
|
||||
const { tools = [], endpoint: _e, ...assistantData } = req.body;
|
||||
const { tools = [], endpoint, ...assistantData } = req.body;
|
||||
assistantData.tools = tools
|
||||
.map((tool) => {
|
||||
if (typeof tool !== 'string') {
|
||||
|
|
@ -31,6 +31,11 @@ const createAssistant = async (req, res) => {
|
|||
assistantData.model = openai.locals.azureOptions.azureOpenAIApiDeploymentName;
|
||||
}
|
||||
|
||||
assistantData.metadata = {
|
||||
author: req.user.id,
|
||||
endpoint,
|
||||
};
|
||||
|
||||
const assistant = await openai.beta.assistants.create(assistantData);
|
||||
if (azureModelIdentifier) {
|
||||
assistant.model = azureModelIdentifier;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue