mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🧪 feat: Experimental: Enable Switching Endpoints Mid-Conversation (#1483)
* fix: load all existing conversation settings on refresh * refactor(buildDefaultConvo): use `lastConversationSetup.endpointType` before `conversation.endpointType` * refactor(TMessage/messageSchema): add `endpoint` field to messages to differentiate generation origin * feat(useNewConvo): `keepLatestMessage` param to prevent reseting the `latestMessage` mid-conversation * style(Settings): adjust height styling to allow more space in dialog for additional settings * feat: Modular Chat: experimental setting to Enable switching Endpoints mid-conversation * fix(ChatRoute): fix potential parsing issue with tPresetSchema
This commit is contained in:
parent
4befee829b
commit
e1a529b5ae
16 changed files with 129 additions and 26 deletions
|
|
@ -516,7 +516,7 @@ class BaseClient {
|
|||
}
|
||||
|
||||
async saveMessageToDatabase(message, endpointOptions, user = null) {
|
||||
await saveMessage({ ...message, user, unfinished: false });
|
||||
await saveMessage({ ...message, endpoint: this.options.endpoint, user, unfinished: false });
|
||||
await saveConvo(user, {
|
||||
conversationId: message.conversationId,
|
||||
endpoint: this.options.endpoint,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ module.exports = {
|
|||
|
||||
async saveMessage({
|
||||
user,
|
||||
endpoint,
|
||||
messageId,
|
||||
newMessageId,
|
||||
conversationId,
|
||||
|
|
@ -34,6 +35,7 @@ module.exports = {
|
|||
|
||||
const update = {
|
||||
user,
|
||||
endpoint,
|
||||
messageId: newMessageId || messageId,
|
||||
conversationId,
|
||||
parentMessageId,
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@ const messageSchema = mongoose.Schema(
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
endpoint: {
|
||||
type: String,
|
||||
},
|
||||
conversationSignature: {
|
||||
type: String,
|
||||
// required: true
|
||||
},
|
||||
clientId: {
|
||||
type: String,
|
||||
|
|
@ -35,7 +37,6 @@ const messageSchema = mongoose.Schema(
|
|||
},
|
||||
parentMessageId: {
|
||||
type: String,
|
||||
// required: true
|
||||
},
|
||||
tokenCount: {
|
||||
type: Number,
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ const AskController = async (req, res, next, initializeClient, addTitle) => {
|
|||
response = { ...response, ...metadata };
|
||||
}
|
||||
|
||||
response.endpoint = endpointOption.endpoint;
|
||||
|
||||
if (client.options.attachments) {
|
||||
userMessage.files = client.options.attachments;
|
||||
delete userMessage.image_urls;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue