mirror of
https://github.com/open-webui/open-webui
synced 2025-01-19 09:16:44 +00:00
enh: ability to set chat controls permissions
This commit is contained in:
parent
56f57928c2
commit
90d4bedae8
@ -30,64 +30,70 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" dark:text-gray-200 text-sm font-primary py-0.5 px-0.5">
|
{#if $user.role === 'admin' || $user.permissions.chat?.controls}
|
||||||
{#if chatFiles.length > 0}
|
<div class=" dark:text-gray-200 text-sm font-primary py-0.5 px-0.5">
|
||||||
<Collapsible title={$i18n.t('Files')} open={true} buttonClassName="w-full">
|
{#if chatFiles.length > 0}
|
||||||
<div class="flex flex-col gap-1 mt-1.5" slot="content">
|
<Collapsible title={$i18n.t('Files')} open={true} buttonClassName="w-full">
|
||||||
{#each chatFiles as file, fileIdx}
|
<div class="flex flex-col gap-1 mt-1.5" slot="content">
|
||||||
<FileItem
|
{#each chatFiles as file, fileIdx}
|
||||||
className="w-full"
|
<FileItem
|
||||||
item={file}
|
className="w-full"
|
||||||
edit={true}
|
item={file}
|
||||||
url={file?.url ? file.url : null}
|
edit={true}
|
||||||
name={file.name}
|
url={file?.url ? file.url : null}
|
||||||
type={file.type}
|
name={file.name}
|
||||||
size={file?.size}
|
type={file.type}
|
||||||
dismissible={true}
|
size={file?.size}
|
||||||
on:dismiss={() => {
|
dismissible={true}
|
||||||
// Remove the file from the chatFiles array
|
on:dismiss={() => {
|
||||||
|
// Remove the file from the chatFiles array
|
||||||
|
|
||||||
chatFiles.splice(fileIdx, 1);
|
chatFiles.splice(fileIdx, 1);
|
||||||
chatFiles = chatFiles;
|
chatFiles = chatFiles;
|
||||||
}}
|
}}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
|
</div>
|
||||||
|
</Collapsible>
|
||||||
|
|
||||||
|
<hr class="my-2 border-gray-50 dark:border-gray-700/10" />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<Collapsible bind:open={showValves} title={$i18n.t('Valves')} buttonClassName="w-full">
|
||||||
|
<div class="text-sm" slot="content">
|
||||||
|
<Valves show={showValves} />
|
||||||
</div>
|
</div>
|
||||||
</Collapsible>
|
</Collapsible>
|
||||||
|
|
||||||
<hr class="my-2 border-gray-50 dark:border-gray-700/10" />
|
<hr class="my-2 border-gray-50 dark:border-gray-700/10" />
|
||||||
{/if}
|
|
||||||
|
|
||||||
<Collapsible bind:open={showValves} title={$i18n.t('Valves')} buttonClassName="w-full">
|
<Collapsible title={$i18n.t('System Prompt')} open={true} buttonClassName="w-full">
|
||||||
<div class="text-sm" slot="content">
|
<div class="" slot="content">
|
||||||
<Valves show={showValves} />
|
<textarea
|
||||||
</div>
|
bind:value={params.system}
|
||||||
</Collapsible>
|
class="w-full text-xs py-1.5 bg-transparent outline-none resize-none"
|
||||||
|
rows="4"
|
||||||
<hr class="my-2 border-gray-50 dark:border-gray-700/10" />
|
placeholder={$i18n.t('Enter system prompt')}
|
||||||
|
/>
|
||||||
<Collapsible title={$i18n.t('System Prompt')} open={true} buttonClassName="w-full">
|
|
||||||
<div class="" slot="content">
|
|
||||||
<textarea
|
|
||||||
bind:value={params.system}
|
|
||||||
class="w-full text-xs py-1.5 bg-transparent outline-none resize-none"
|
|
||||||
rows="4"
|
|
||||||
placeholder={$i18n.t('Enter system prompt')}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Collapsible>
|
|
||||||
|
|
||||||
<hr class="my-2 border-gray-50 dark:border-gray-700/10" />
|
|
||||||
|
|
||||||
<Collapsible title={$i18n.t('Advanced Params')} open={true} buttonClassName="w-full">
|
|
||||||
<div class="text-sm mt-1.5" slot="content">
|
|
||||||
<div>
|
|
||||||
<AdvancedParams admin={$user?.role === 'admin'} bind:params />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Collapsible>
|
||||||
</Collapsible>
|
|
||||||
</div>
|
<hr class="my-2 border-gray-50 dark:border-gray-700/10" />
|
||||||
|
|
||||||
|
<Collapsible title={$i18n.t('Advanced Params')} open={true} buttonClassName="w-full">
|
||||||
|
<div class="text-sm mt-1.5" slot="content">
|
||||||
|
<div>
|
||||||
|
<AdvancedParams admin={$user?.role === 'admin'} bind:params />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Collapsible>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="text-sm dark:text-gray-300 text-center py-2 px-10">
|
||||||
|
{$i18n.t('You do not have permission to access this feature.')}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
<hr class="border-black/5 dark:border-white/5 my-1" />
|
<hr class="border-black/5 dark:border-white/5 my-1" />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if $config?.features?.enable_web_search}
|
{#if $config?.features?.enable_web_search && ($user.role === 'admin' || $user.permissions.features?.web_search)}
|
||||||
<button
|
<button
|
||||||
class="flex w-full justify-between gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer rounded-xl"
|
class="flex w-full justify-between gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer rounded-xl"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</Menu>
|
</Menu>
|
||||||
{:else if $mobile}
|
{:else if $mobile && ($user.role === 'admin' || $user.permissions.chat?.controls)}
|
||||||
<Tooltip content={$i18n.t('Controls')}>
|
<Tooltip content={$i18n.t('Controls')}>
|
||||||
<button
|
<button
|
||||||
class=" flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition"
|
class=" flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition"
|
||||||
@ -130,7 +130,7 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !$mobile}
|
{#if !$mobile && ($user.role === 'admin' || $user.permissions.chat?.controls)}
|
||||||
<Tooltip content={$i18n.t('Controls')}>
|
<Tooltip content={$i18n.t('Controls')}>
|
||||||
<button
|
<button
|
||||||
class=" flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition"
|
class=" flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition"
|
||||||
|
Loading…
Reference in New Issue
Block a user