mirror of
https://github.com/open-webui/computer.git
synced 2026-11-24 14:30:22 -05:00
refac
This commit is contained in:
1 parent
e2f4f69702
commit
556db8aebf
7 files changed
+144
-42
No files matched your search
@@ -7,12 +7,17 @@
|
||||
|
||||
let loading = $state(true);
|
||||
let saving = $state(false);
|
||||
let enabled = $state(true);
|
||||
let toolEnabled = $state(true);
|
||||
let backgroundReview = $state(true);
|
||||
let reviewInterval = $state(10);
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const config = await getAdminConfig();
|
||||
enabled = config['skills.enabled'] !== false && config['skills.enabled'] !== 'false';
|
||||
toolEnabled =
|
||||
config['skills.tool_enabled'] !== false && config['skills.tool_enabled'] !== 'false';
|
||||
backgroundReview =
|
||||
config['skills.background_review_enabled'] !== false &&
|
||||
config['skills.background_review_enabled'] !== 'false';
|
||||
@@ -27,6 +32,8 @@
|
||||
saving = true;
|
||||
try {
|
||||
await updateConfig({
|
||||
'skills.enabled': enabled,
|
||||
'skills.tool_enabled': toolEnabled,
|
||||
'skills.background_review_enabled': backgroundReview,
|
||||
'skills.review_interval_turns': Math.max(1, Number(reviewInterval) || 10)
|
||||
});
|
||||
@@ -39,48 +46,72 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col min-h-full">
|
||||
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">Skills</h2>
|
||||
|
||||
<div class="flex flex-col h-full">
|
||||
{#if loading}
|
||||
<div class="flex justify-center py-8"><Spinner size={16} /></div>
|
||||
{:else}
|
||||
<div class="flex flex-col gap-2.5">
|
||||
<label class="flex items-center justify-between cursor-pointer">
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400">Background review</span>
|
||||
<ToggleSwitch
|
||||
value={backgroundReview}
|
||||
onchange={(v) => {
|
||||
backgroundReview = v;
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
<p class="text-[0.6875rem] text-gray-400 dark:text-gray-600 -mt-1">
|
||||
Let Computer create or update managed skills after successful reusable work.
|
||||
</p>
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5 -mr-1.5">
|
||||
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">Skills</h2>
|
||||
|
||||
{#if backgroundReview}
|
||||
<div>
|
||||
<label class="text-xs text-gray-600 dark:text-gray-400" for="skills-review-interval"
|
||||
>Review interval</label
|
||||
>
|
||||
<div class="flex items-center gap-1.5 mt-1">
|
||||
<h3 class="text-xs text-gray-400 dark:text-gray-600 mb-2">Behavior</h3>
|
||||
<div class="flex flex-col gap-2.5">
|
||||
<label class="flex items-center justify-between cursor-pointer">
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400">Enable skills</span>
|
||||
<ToggleSwitch
|
||||
value={enabled}
|
||||
onchange={(v) => {
|
||||
enabled = v;
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
|
||||
{#if enabled}
|
||||
<label class="flex items-center justify-between cursor-pointer">
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400"
|
||||
>Assistant can manage skills</span
|
||||
>
|
||||
<ToggleSwitch
|
||||
value={toolEnabled}
|
||||
onchange={(v) => {
|
||||
toolEnabled = v;
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="flex items-center justify-between cursor-pointer">
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400">Background review</span>
|
||||
<ToggleSwitch
|
||||
value={backgroundReview}
|
||||
onchange={(v) => {
|
||||
backgroundReview = v;
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if enabled}
|
||||
<h3 class="text-xs text-gray-400 dark:text-gray-600 mb-2 mt-5">Limits</h3>
|
||||
<div class="flex flex-col gap-2.5">
|
||||
<div>
|
||||
<label class="text-xs text-gray-600 dark:text-gray-400" for="skills-review-interval">
|
||||
Review every
|
||||
</label>
|
||||
<input
|
||||
id="skills-review-interval"
|
||||
type="number"
|
||||
bind:value={reviewInterval}
|
||||
min="1"
|
||||
class="w-16 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors"
|
||||
class="w-full mt-1 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none transition-colors"
|
||||
/>
|
||||
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600">turns</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="mt-5 pt-4 border-t border-gray-100 dark:border-white/8">
|
||||
<div class="shrink-0 pt-3 flex justify-end">
|
||||
<button
|
||||
class="h-8 px-3 rounded-lg text-xs bg-gray-900 dark:bg-white text-white dark:text-black hover:bg-gray-700 dark:hover:bg-gray-200 transition-colors disabled:opacity-50"
|
||||
class="text-[0.8125rem] text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors duration-100 disabled:opacity-50"
|
||||
disabled={saving}
|
||||
onclick={save}
|
||||
>
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
'connections',
|
||||
'agents',
|
||||
'models',
|
||||
'skills',
|
||||
'messaging',
|
||||
'gateway',
|
||||
'audio',
|
||||
@@ -74,7 +73,8 @@
|
||||
'web',
|
||||
'toolservers',
|
||||
'subagents',
|
||||
'memory'
|
||||
'memory',
|
||||
'skills'
|
||||
];
|
||||
|
||||
const personalTabs: SettingsTab[] = $derived.by(() => {
|
||||
@@ -95,7 +95,6 @@
|
||||
{ id: 'connections', label: $t('admin.connections'), icon: 'plug' },
|
||||
{ id: 'agents', label: $t('admin.agents'), icon: 'terminal' },
|
||||
{ id: 'models', label: $t('admin.models'), icon: 'cube' },
|
||||
{ id: 'skills', label: 'Skills', icon: 'spark' },
|
||||
{ id: 'messaging', label: $t('admin.messaging'), icon: 'chat-bubble' },
|
||||
{ id: 'gateway', label: $t('admin.gateway.tab'), icon: 'gateway' },
|
||||
{ id: 'audio', label: $t('admin.audio.title'), icon: 'microphone' },
|
||||
@@ -103,7 +102,8 @@
|
||||
{ id: 'web', label: $t('admin.web'), icon: 'globe' },
|
||||
{ id: 'toolservers', label: $t('admin.toolServers'), icon: 'plug' },
|
||||
{ id: 'subagents', label: $t('admin.subagents'), icon: 'user' },
|
||||
{ id: 'memory', label: $t('settings.memory'), icon: 'brain' }
|
||||
{ id: 'memory', label: $t('settings.memory'), icon: 'brain' },
|
||||
{ id: 'skills', label: 'Skills', icon: 'spark' }
|
||||
]);
|
||||
|
||||
onMount(() => {
|
||||
|
||||
Reference in new issue
Block a user