mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-02 17:57:57 -05:00
refac
This commit is contained in:
1 parent
d3e87f8b14
commit
f68be3a4bb
3 files changed
+34
-3
No files matched your search
@@ -596,6 +596,14 @@
|
||||
$: canOpenChatTab =
|
||||
$user?.role === 'admin' ||
|
||||
($user?.role === 'user' && ($user.permissions?.chat?.side_chat ?? false));
|
||||
// A fixed machine has to be reachable. Replies in someone else's chat may run on its owner's access.
|
||||
$: canUseMachine =
|
||||
!$config?.features?.enable_tool_servers ||
|
||||
!machineFixed ||
|
||||
isShared ||
|
||||
!$selectedMachineId ||
|
||||
$machines === null ||
|
||||
$machines.some((machine) => machine.id === $selectedMachineId);
|
||||
let cloning = false;
|
||||
|
||||
const cloneSharedChat = async () => {
|
||||
@@ -4837,6 +4845,10 @@
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
|
||||
if (!canUseMachine) {
|
||||
toast.error($i18n.t('This machine is offline or not shared with you'));
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
if (pendingOAuthTools.some((tool) => !isSystemOAuthTool(tool.id))) {
|
||||
toast.warning($i18n.t('Please connect all required integrations before sending a message'));
|
||||
return { status: 'rejected' };
|
||||
@@ -6554,6 +6566,10 @@
|
||||
<MessageInput
|
||||
{selectedMachineId}
|
||||
machineSelectionEnabled={!machineFixed}
|
||||
disabled={!canUseMachine}
|
||||
placeholder={canUseMachine
|
||||
? ''
|
||||
: $i18n.t('This machine is offline or not shared with you')}
|
||||
{machineSkills}
|
||||
{messagesContainerId}
|
||||
{inputId}
|
||||
@@ -6688,6 +6704,10 @@
|
||||
<MessageInput
|
||||
{selectedMachineId}
|
||||
machineSelectionEnabled={!machineFixed}
|
||||
disabled={!canUseMachine}
|
||||
placeholder={canUseMachine
|
||||
? ''
|
||||
: $i18n.t('This machine is offline or not shared with you')}
|
||||
{machineSkills}
|
||||
{messagesContainerId}
|
||||
{inputId}
|
||||
@@ -6775,6 +6795,10 @@
|
||||
bind:folderTabActions
|
||||
{selectedMachineId}
|
||||
machineSelectionEnabled={!machineFixed}
|
||||
disabled={!canUseMachine}
|
||||
placeholder={canUseMachine
|
||||
? ''
|
||||
: $i18n.t('This machine is offline or not shared with you')}
|
||||
{machineSkills}
|
||||
chatId={$chatId}
|
||||
{onTemporaryChange}
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
export let onTemporaryChange: ((value: boolean) => void) | null = null;
|
||||
export let machineContext: MachineContext | null = null;
|
||||
export let machineSelectionEnabled = true;
|
||||
export let disabled = false;
|
||||
export let contextUsage = null;
|
||||
export let contextCompactionEnabled = false;
|
||||
export let embedded = false;
|
||||
@@ -2231,12 +2232,15 @@
|
||||
<div
|
||||
id={inputId === 'chat-input' ? 'message-input-container' : `${inputId}-wrapper`}
|
||||
data-composer-id={inputId}
|
||||
inert={disabled && !isActive}
|
||||
class="flex-1 flex flex-col relative w-full shadow-[0_6px_24px_-4px_rgba(0,0,0,0.1)] rounded-3xl border {$temporary
|
||||
? 'border-dashed border-base-300/70 dark:border-base-700/70'
|
||||
: ' border-base-200/60 dark:border-base-800/40'} {($settings?.highContrastMode ??
|
||||
false)
|
||||
? 'focus-within:outline focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-blue-500 [&_.ProseMirror:focus-visible]:outline-none!'
|
||||
: ''} transition px-0.5 bg-base-0/80 dark:bg-[color-mix(in_oklab,var(--color-base-850)_55%,var(--color-base-900))]/90 backdrop-blur-md dark:text-base-100"
|
||||
: ''} {disabled && !isActive
|
||||
? 'opacity-60'
|
||||
: ''} transition px-0.5 bg-base-0/80 dark:bg-[color-mix(in_oklab,var(--color-base-850)_55%,var(--color-base-900))]/90 backdrop-blur-md dark:text-base-100"
|
||||
dir={$settings?.chatDirection ?? 'auto'}
|
||||
>
|
||||
{#if atSelectedModel !== undefined}
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
export let files = [];
|
||||
export let machineContext: MachineContext | null = null;
|
||||
export let machineSelectionEnabled = true;
|
||||
export let disabled = false;
|
||||
export let placeholder = '';
|
||||
export let selectedMachineId: Pick<Writable<string | null>, 'subscribe' | 'set'>;
|
||||
export let machineSkills: Writable<any[]>;
|
||||
export let messageInput = null;
|
||||
@@ -152,10 +154,11 @@
|
||||
!$selectedFolder.write_access;
|
||||
</script>
|
||||
|
||||
{#snippet composer(placeholder = '')}
|
||||
{#snippet composer(defaultPlaceholder = '')}
|
||||
<MessageInput
|
||||
{selectedMachineId}
|
||||
{machineSelectionEnabled}
|
||||
{disabled}
|
||||
{machineSkills}
|
||||
{chatId}
|
||||
{onTemporaryChange}
|
||||
@@ -190,7 +193,7 @@
|
||||
{onToolApprovalModeChange}
|
||||
{stopResponse}
|
||||
{createMessagePair}
|
||||
{placeholder}
|
||||
placeholder={placeholder || defaultPlaceholder}
|
||||
{onChange}
|
||||
{onUpload}
|
||||
{onUpdate}
|
||||
|
||||
Reference in new issue
Block a user