mirror of
https://github.com/open-webui/open-webui
synced 2024-11-06 08:56:39 +00:00
feat: use the conversation's model instead of the first model for query gen
This commit is contained in:
parent
eb509c460a
commit
69bac2a20e
@ -316,7 +316,7 @@
|
||||
}
|
||||
|
||||
if (useWebSearch) {
|
||||
await runWebSearchForPrompt(parentId, responseMessageId);
|
||||
await runWebSearchForPrompt(model.id, parentId, responseMessageId);
|
||||
}
|
||||
|
||||
if (model?.external) {
|
||||
@ -334,11 +334,11 @@
|
||||
await chats.set(await getChatList(localStorage.token));
|
||||
};
|
||||
|
||||
const runWebSearchForPrompt = async (parentId: string, responseId: string) => {
|
||||
const runWebSearchForPrompt = async (model: string, parentId: string, responseId: string) => {
|
||||
const responseMessage = history.messages[responseId];
|
||||
responseMessage.progress = $i18n.t('Generating search query');
|
||||
messages = messages;
|
||||
const searchQuery = await generateChatSearchQuery(parentId);
|
||||
const searchQuery = await generateChatSearchQuery(model, parentId);
|
||||
if (!searchQuery) {
|
||||
toast.warning($i18n.t('No search query generated'));
|
||||
responseMessage.progress = undefined;
|
||||
@ -913,13 +913,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
const generateChatSearchQuery = async (messageId: string) => {
|
||||
const model = $models.find((model) => model.id === selectedModels[0]);
|
||||
const generateChatSearchQuery = async (modelId: string, messageId: string) => {
|
||||
const model = $models.find((model) => model.id === modelId);
|
||||
|
||||
const taskModelId =
|
||||
model?.external ?? false
|
||||
? $settings?.title?.modelExternal ?? selectedModels[0]
|
||||
: $settings?.title?.model ?? selectedModels[0];
|
||||
? $settings?.title?.modelExternal ?? modelId
|
||||
: $settings?.title?.model ?? modelId;
|
||||
const taskModel = $models.find((model) => model.id === taskModelId);
|
||||
|
||||
const userMessage = history.messages[messageId];
|
||||
|
@ -323,7 +323,7 @@
|
||||
}
|
||||
|
||||
if (useWebSearch) {
|
||||
await runWebSearchForPrompt(parentId, responseMessageId);
|
||||
await runWebSearchForPrompt(model.id, parentId, responseMessageId);
|
||||
}
|
||||
|
||||
if (model?.external) {
|
||||
@ -334,17 +334,18 @@
|
||||
} else {
|
||||
toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
await chats.set(await getChatList(localStorage.token));
|
||||
};
|
||||
|
||||
const runWebSearchForPrompt = async (parentId: string, responseId: string) => {
|
||||
const runWebSearchForPrompt = async (model: string, parentId: string, responseId: string) => {
|
||||
const responseMessage = history.messages[responseId];
|
||||
responseMessage.progress = $i18n.t('Generating search query');
|
||||
messages = messages;
|
||||
const searchQuery = await generateChatSearchQuery(parentId);
|
||||
const searchQuery = await generateChatSearchQuery(model, parentId);
|
||||
if (!searchQuery) {
|
||||
toast.warning($i18n.t('No search query generated'));
|
||||
responseMessage.progress = undefined;
|
||||
@ -369,7 +370,7 @@
|
||||
type: 'websearch',
|
||||
upload_status: true,
|
||||
error: '',
|
||||
urls: searchDocument.filenames,
|
||||
urls: searchDocument.filenames
|
||||
});
|
||||
responseMessage.progress = undefined;
|
||||
messages = messages;
|
||||
@ -919,13 +920,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
const generateChatSearchQuery = async (messageId: string) => {
|
||||
const model = $models.find((model) => model.id === selectedModels[0]);
|
||||
const generateChatSearchQuery = async (modelId: string, messageId: string) => {
|
||||
const model = $models.find((model) => model.id === modelId);
|
||||
|
||||
const taskModelId =
|
||||
model?.external ?? false
|
||||
? $settings?.title?.modelExternal ?? selectedModels[0]
|
||||
: $settings?.title?.model ?? selectedModels[0];
|
||||
? $settings?.title?.modelExternal ?? modelId
|
||||
: $settings?.title?.model ?? modelId;
|
||||
const taskModel = $models.find((model) => model.id === taskModelId);
|
||||
|
||||
const userMessage = history.messages[messageId];
|
||||
|
Loading…
Reference in New Issue
Block a user