feat: artifacts system prompt in backend

This commit is contained in:
Danny Avila 2024-08-24 01:02:03 -04:00
parent fa0032d91d
commit e3bcfc560d
11 changed files with 225 additions and 3 deletions

View file

@ -1,4 +1,5 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody) => {
const {
@ -10,6 +11,7 @@ const buildOptions = (endpoint, parsedBody) => {
iconURL,
greeting,
spec,
artifacts,
...modelOptions
} = parsedBody;
@ -26,6 +28,10 @@ const buildOptions = (endpoint, parsedBody) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};

View file

@ -1,8 +1,10 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody) => {
// eslint-disable-next-line no-unused-vars
const { promptPrefix, assistant_id, iconURL, greeting, spec, ...modelOptions } = parsedBody;
const { promptPrefix, assistant_id, iconURL, greeting, spec, artifacts, ...modelOptions } =
parsedBody;
const endpointOption = removeNullishValues({
endpoint,
promptPrefix,
@ -13,6 +15,10 @@ const buildOptions = (endpoint, parsedBody) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};

View file

@ -1,8 +1,10 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody) => {
// eslint-disable-next-line no-unused-vars
const { promptPrefix, assistant_id, iconURL, greeting, spec, ...modelOptions } = parsedBody;
const { promptPrefix, assistant_id, iconURL, greeting, spec, artifacts, ...modelOptions } =
parsedBody;
const endpointOption = removeNullishValues({
endpoint,
promptPrefix,
@ -13,6 +15,10 @@ const buildOptions = (endpoint, parsedBody) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};

View file

@ -1,4 +1,5 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody, endpointType) => {
const {
@ -10,6 +11,7 @@ const buildOptions = (endpoint, parsedBody, endpointType) => {
iconURL,
greeting,
spec,
artifacts,
...modelOptions
} = parsedBody;
const endpointOption = removeNullishValues({
@ -26,6 +28,10 @@ const buildOptions = (endpoint, parsedBody, endpointType) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};

View file

@ -1,4 +1,5 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody) => {
const {
@ -9,6 +10,7 @@ const buildOptions = (endpoint, parsedBody) => {
iconURL,
greeting,
spec,
artifacts,
...modelOptions
} = parsedBody;
const endpointOption = removeNullishValues({
@ -23,6 +25,10 @@ const buildOptions = (endpoint, parsedBody) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};

View file

@ -1,4 +1,5 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody) => {
const {
@ -10,6 +11,7 @@ const buildOptions = (endpoint, parsedBody) => {
greeting,
spec,
maxContextTokens,
artifacts,
...modelOptions
} = parsedBody;
const endpointOption = removeNullishValues({
@ -28,6 +30,10 @@ const buildOptions = (endpoint, parsedBody) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};

View file

@ -1,4 +1,5 @@
const { removeNullishValues } = require('librechat-data-provider');
const artifactsPrompt = require('~/app/clients/prompts/artifacts');
const buildOptions = (endpoint, parsedBody) => {
const {
@ -10,8 +11,10 @@ const buildOptions = (endpoint, parsedBody) => {
iconURL,
greeting,
spec,
artifacts,
...modelOptions
} = parsedBody;
const endpointOption = removeNullishValues({
endpoint,
chatGptLabel,
@ -25,6 +28,10 @@ const buildOptions = (endpoint, parsedBody) => {
modelOptions,
});
if (artifacts === 'default') {
endpointOption.promptPrefix = `${promptPrefix ?? ''}\n${artifactsPrompt}`.trim();
}
return endpointOption;
};