{editingItem || editingConnection ? $i18n.t('Edit Knowledge Connection') : $i18n.t('Add Knowledge Connection')}

{#if !connectionMode}
{/if}
{#if textSearch} {/if}
{#if sourceForm.provider !== 'pgvector'}
{/if}
{#if sourceForm.provider === 'milvus'}
{/if}
{#if textSearch && !editingItem}
{/if}
{#if textSearch} {#if storeIds.length > 0}
{#each storeIds as id (id)}
{storeOptions.find((store) => store.id === id)?.name ?? id}
{/each}
{/if} addStoreIds(storeIdInput)} on:keydown={(e) => { if (e.isComposing || e.keyCode === 229) return; if (e.key === 'Enter' || e.key === ',') { e.preventDefault(); addStoreIds(storeIdInput); } }} placeholder={connectionMode ? $i18n.t('Leave empty to include all stores') : $i18n.t('Add a vector store ID')} list="external-source-stores" autocomplete="off" /> {#each storeOptions.filter((store) => !storeIds.includes(store.id)) as store (store.id)} {/each} {:else}
{/if}
{#if sourceForm.provider === 'pgvector'}
{/if} {#if !textSearch}
{/if} {#if connectionMode}
{$i18n.t( 'Each store this connection lists appears as a knowledge base, read live from the endpoint. Access below applies to all of them.' )}
{:else}
{#if !textSearch}
{$i18n.t( 'External vectors must be generated with the same embedding model configured in Open WebUI.' )}
{/if}
{/if}
{#if showAdvanced}
{/if}
{ if (editingItem) { const item = editingItem; creating = true; try { await updateKnowledgeAccessGrants(localStorage.token, item.id, grants); item.access_grants = structuredClone(grants); if (editingItem === item) accessGrants = item.access_grants; toast.success($i18n.t('Saved')); } catch (error) { if (editingItem === item) accessGrants = structuredClone(item.access_grants ?? []); toast.error(`${error}`); } finally { creating = false; } } }} />
{#if connectionMode && editingConnection} {:else}
{/if}
{$i18n.t('settings.admin.integrations.externalKnowledge.title')}
{#each connections.filter(hasStoreIds) as connection (connection.id)}
{' '} {connection.provider} · {connection.config?.store_ids?.length ? $i18n.t('{{COUNT}} stores', { COUNT: connection.config.store_ids.length }) : $i18n.t('All stores')}
toggleConnection(connection)} />
{/each} {#each items as item} {@const connection = connectionForItem(item)}
{' '} {item?.meta?.external?.provider ?? connection?.provider} {item?.meta?.external?.source?.name ? `· ${item.meta.external.source.name}` : ''}
{ toggleConnection(connection); }} />
{/each}
{#if items.length === 0 && !connections.some(hasStoreIds)}
{$i18n.t('No external knowledge sources configured.')}
{/if}