mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +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
|
|
@ -46,6 +46,7 @@ const useNewConvo = (index = 0) => {
|
|||
preset: TPreset | null = null,
|
||||
modelsData?: TModelsConfig,
|
||||
buildDefault?: boolean,
|
||||
keepLatestMessage?: boolean,
|
||||
) => {
|
||||
const modelsConfig = modelsData ?? snapshot.getLoadable(store.modelsConfig).contents;
|
||||
const { endpoint = null } = conversation;
|
||||
|
|
@ -84,7 +85,9 @@ const useNewConvo = (index = 0) => {
|
|||
setStorage(conversation);
|
||||
setConversation(conversation);
|
||||
setSubmission({} as TSubmission);
|
||||
resetLatestMessage();
|
||||
if (!keepLatestMessage) {
|
||||
resetLatestMessage();
|
||||
}
|
||||
|
||||
if (conversation.conversationId === 'new' && !modelsData) {
|
||||
navigate('new');
|
||||
|
|
@ -99,11 +102,13 @@ const useNewConvo = (index = 0) => {
|
|||
preset,
|
||||
modelsData,
|
||||
buildDefault = true,
|
||||
keepLatestMessage = false,
|
||||
}: {
|
||||
template?: Partial<TConversation>;
|
||||
preset?: TPreset;
|
||||
modelsData?: TModelsConfig;
|
||||
buildDefault?: boolean;
|
||||
keepLatestMessage?: boolean;
|
||||
} = {}) => {
|
||||
const conversation = {
|
||||
conversationId: 'new',
|
||||
|
|
@ -130,7 +135,7 @@ const useNewConvo = (index = 0) => {
|
|||
}
|
||||
}
|
||||
|
||||
switchToConversation(conversation, preset, modelsData, buildDefault);
|
||||
switchToConversation(conversation, preset, modelsData, buildDefault, keepLatestMessage);
|
||||
},
|
||||
[switchToConversation, files, mutateAsync, setFiles],
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue