mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-22 21:50:42 -05:00
refac
This commit is contained in:
1 parent
0132d879c0
commit
0dcf8ac53f
2 files changed
+14
-10
No files matched your search
@@ -190,6 +190,11 @@
|
||||
const chatTitle = embedded ? writable('') : _chatTitle;
|
||||
const audioQueue = embedded ? writable<AudioQueue | null>(null) : _audioQueue;
|
||||
const temporaryChat = embedded ? writable(false) : _temporaryChat;
|
||||
export const isTemporary = () => get(temporaryChat);
|
||||
const isTemporaryEnforced = () =>
|
||||
$user?.role !== 'admin' &&
|
||||
!!$user?.permissions?.chat?.temporary &&
|
||||
!!$user?.permissions?.chat?.temporary_enforced;
|
||||
const selectedFolder = embedded ? writable<FolderDetails | null>(null) : _selectedFolder;
|
||||
const showTabs = embedded ? writable(get(_showTabs)) : _showTabs;
|
||||
// the call lives in the main chat's voice tab, so a side chat is never in it
|
||||
@@ -1113,7 +1118,7 @@
|
||||
if (embeddedDraft) {
|
||||
({ selectedModels, params, history, chatFiles, prompt, files } = embeddedDraft);
|
||||
branchPointMessageId = history.currentId;
|
||||
await temporaryChat.set(embeddedDraft.temporary);
|
||||
await temporaryChat.set(isTemporaryEnforced() || embeddedDraft.temporary);
|
||||
}
|
||||
|
||||
await setDefaults();
|
||||
@@ -2989,9 +2994,7 @@
|
||||
|
||||
const param = searchParams.get('temporary-chat');
|
||||
temporaryChat.set(
|
||||
($user?.role !== 'admin' &&
|
||||
!!$user?.permissions?.chat?.temporary &&
|
||||
!!$user?.permissions?.chat?.temporary_enforced) ||
|
||||
isTemporaryEnforced() ||
|
||||
(!!canUseTemporaryChats({ user: $user, config: $config }) &&
|
||||
(temporary ?? (param ? param === 'true' : !!$settings?.temporaryChatByDefault)))
|
||||
);
|
||||
|
||||
@@ -12,7 +12,12 @@
|
||||
|
||||
export let initialPrompt = '';
|
||||
export let initialView: any = null;
|
||||
export const captureView = () => ({ draft, files, context });
|
||||
export const captureView = () => ({
|
||||
draft,
|
||||
files,
|
||||
context,
|
||||
temporary: chatView?.isTemporary() ?? false
|
||||
});
|
||||
export let chatId = '';
|
||||
export let streaming = false;
|
||||
export let artifacts: Writable<{ type: string; content: string }[]> = writable([]);
|
||||
@@ -90,11 +95,7 @@
|
||||
: {},
|
||||
history: convertMessagesToHistory(context),
|
||||
chatFiles: contextFiles(),
|
||||
temporary:
|
||||
!chatId &&
|
||||
$user?.role !== 'admin' &&
|
||||
($user?.permissions?.chat?.temporary ?? true) &&
|
||||
($user?.permissions?.chat?.temporary_enforced ?? false),
|
||||
temporary: initialView?.temporary ?? false,
|
||||
prompt: draft,
|
||||
files
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user