diff --git a/src/lib/components/workspace/Models/Knowledge.svelte b/src/lib/components/workspace/Models/Knowledge.svelte
index a130218431..597ce0d438 100644
--- a/src/lib/components/workspace/Models/Knowledge.svelte
+++ b/src/lib/components/workspace/Models/Knowledge.svelte
@@ -3,7 +3,14 @@
import { config, knowledge, settings, user } from '$lib/stores';
import KnowledgeSelector from './Knowledge/KnowledgeSelector.svelte';
- import FileItem from '$lib/components/common/FileItem.svelte';
+ import Tooltip from '$lib/components/common/Tooltip.svelte';
+ import Spinner from '$lib/components/common/Spinner.svelte';
+ import ChatBubble from '$lib/components/icons/ChatBubble.svelte';
+ import Database from '$lib/components/icons/Database.svelte';
+ import DocumentPage from '$lib/components/icons/DocumentPage.svelte';
+ import Folder from '$lib/components/icons/Folder.svelte';
+ import PageEdit from '$lib/components/icons/PageEdit.svelte';
+ import XMark from '$lib/components/icons/XMark.svelte';
import { getKnowledgeBases } from '$lib/apis/knowledge';
import { uploadFile } from '$lib/apis/files';
@@ -155,79 +162,118 @@
/>
-
-
-
-
- {$i18n.t('Knowledge')}
-
+
+
+
+
+
+ {$i18n.t('Knowledge')}
+
+
+
+ {#if loaded}
+
+
+
{
+ const item = e.detail;
+
+ if (!selectedItems.find((k) => k.id === item.id)) {
+ selectedItems = [
+ ...selectedItems,
+ {
+ ...item
+ }
+ ];
+ }
+ }}
+ >
+
+ {$i18n.t('Select Knowledge')}
+
+
+
+
+ {#if $user?.role === 'admin' || $user?.permissions?.chat?.file_upload}
+
{
+ filesInputElement.click();
+ }}
+ >
+ {$i18n.t('Upload')}
+
+ {/if}
+
+ {/if}
-
+
{#if selectedItems?.length > 0}
-
+
{#each selectedItems as file, fileIdx}
- {
- selectedItems = selectedItems.filter((_, idx) => idx !== fileIdx);
- }}
- />
- {/each}
-
- {/if}
-
- {#if loaded}
-
-
-
{
- const item = e.detail;
-
- if (!selectedItems.find((k) => k.id === item.id)) {
- selectedItems = [
- ...selectedItems,
- {
- ...item
- }
- ];
- }
- }}
- >
+
- {$i18n.t('Select Knowledge')}
-
-
-
+
+ {#if file.status === 'uploading'}
+
+ {:else if file.type === 'collection'}
+
+ {:else if file.type === 'note'}
+
+ {:else if file.type === 'chat'}
+
+ {:else if file.type === 'folder'}
+
+ {:else}
+
+ {/if}
+
- {#if $user?.role === 'admin' || $user?.permissions?.chat?.file_upload}
-
{
- filesInputElement.click();
- }}
- >
- {$i18n.t('Upload')}
-
- {/if}
+
+ {file.name || file.id}
+
+
+ {#if file.status === 'uploading'}
+
+ {$i18n.t('Uploading')}
+
+ {/if}
+
+
{
+ selectedItems = selectedItems.filter((_, idx) => idx !== fileIdx);
+ }}
+ >
+
+
+
+
+ {/each}
+
+
{
+ selectedItems = [];
+ }}
+ >
+ {$i18n.t('Disable all')}
+
{/if}
+
diff --git a/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte b/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte
index 994d41946b..ebde897e4b 100644
--- a/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte
+++ b/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte
@@ -155,7 +155,7 @@
{/if}
-
+
-
{#if activeSkills.length > 0}
{
toggleSkill(e.detail);
}}
@@ -48,8 +48,12 @@
];
}}
/>
+ {/if}
+
-
+
+ {#if activeSkills.length > 0}
+
{#each selectedSkills as skill, skillIdx}
@@ -79,7 +83,7 @@
selectedSkillIds = [];
}}
>
- Disable all
+ {$i18n.t('Disable all')}
{/if}
diff --git a/src/lib/components/workspace/Models/ToolsSelector.svelte b/src/lib/components/workspace/Models/ToolsSelector.svelte
index 92e015f3a2..e754087987 100644
--- a/src/lib/components/workspace/Models/ToolsSelector.svelte
+++ b/src/lib/components/workspace/Models/ToolsSelector.svelte
@@ -27,18 +27,18 @@
-
+
-
{#if tools.length > 0}
{
toggleTool(e.detail);
}}
@@ -46,8 +46,12 @@
selectedToolIds = [...new Set([...selectedToolIds, ...e.detail.map((tool) => tool.id)])];
}}
/>
+ {/if}
+
-
+
+ {#if tools.length > 0}
+
{#each selectedTools as tool, toolIdx}
@@ -77,7 +81,7 @@
selectedToolIds = [];
}}
>
- Disable all
+ {$i18n.t('Disable all')}
{/if}
diff --git a/src/lib/components/workspace/Models/TypeaheadSelector.svelte b/src/lib/components/workspace/Models/TypeaheadSelector.svelte
index db5c45593d..ed4c44c60e 100644
--- a/src/lib/components/workspace/Models/TypeaheadSelector.svelte
+++ b/src/lib/components/workspace/Models/TypeaheadSelector.svelte
@@ -1,5 +1,7 @@
-
- {
- dispatch('select', e.detail);
- if (selectedIds === null) value = '';
+{#if variant === 'dropdown'}
+ {
+ if (!state) {
+ value = '';
+ }
}}
- on:enableall={(e) => dispatch('enableall', e.detail)}
- />
-
+ >
+
+ {triggerLabel || placeholder}
+
+
+
+
+{:else}
+
+ {
+ dispatch('select', e.detail);
+ if (selectedIds === null) value = '';
+ }}
+ on:enableall={(e) => dispatch('enableall', e.detail)}
+ />
+
+{/if}