refac
This commit is contained in:
@@ -52,6 +52,7 @@ type YoutubeConfigForm = {
|
||||
|
||||
type RAGConfigForm = {
|
||||
PDF_EXTRACT_IMAGES?: boolean;
|
||||
CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES?: string[];
|
||||
ENABLE_GOOGLE_DRIVE_INTEGRATION?: boolean;
|
||||
ENABLE_ONEDRIVE_INTEGRATION?: boolean;
|
||||
EXTERNAL_DOCUMENT_LOADER_HEADERS?: Record<string, string>;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
import AdminSettingRow from './AdminSettingRow.svelte';
|
||||
import AdminSettingSection from './AdminSettingSection.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
const i18n: any = getContext('i18n');
|
||||
|
||||
let updateEmbeddingModelLoading = false;
|
||||
let updateRerankingModelLoading = false;
|
||||
@@ -69,7 +69,7 @@
|
||||
hybrid: false
|
||||
};
|
||||
|
||||
let RAGConfig = null;
|
||||
let RAGConfig: any = null;
|
||||
const inputClass =
|
||||
'w-full h-7 rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 text-xs text-gray-700 outline-hidden transition-colors placeholder:text-gray-300 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:placeholder:text-gray-700 dark:focus:border-blue-500';
|
||||
const actionButtonClass =
|
||||
@@ -272,6 +272,12 @@
|
||||
RAGConfig.EXTERNAL_DOCUMENT_LOADER_HEADERS.trim() !== ''
|
||||
? JSON.parse(RAGConfig.EXTERNAL_DOCUMENT_LOADER_HEADERS)
|
||||
: {},
|
||||
CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES:
|
||||
RAGConfig.CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES.trim() === ''
|
||||
? undefined
|
||||
: RAGConfig.CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES.split(',')
|
||||
.map((mimeType: string) => mimeType.trim())
|
||||
.filter((mimeType: string) => mimeType !== ''),
|
||||
MINERU_PARAMS:
|
||||
typeof RAGConfig.MINERU_PARAMS === 'string' && RAGConfig.MINERU_PARAMS.trim() !== ''
|
||||
? JSON.parse(RAGConfig.MINERU_PARAMS)
|
||||
@@ -328,6 +334,9 @@
|
||||
: config.EXTERNAL_DOCUMENT_LOADER_HEADERS;
|
||||
|
||||
config.MINERU_FILE_EXTENSIONS = (config?.MINERU_FILE_EXTENSIONS ?? ['pdf']).join(', ');
|
||||
config.CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES = (
|
||||
config?.CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES ?? []
|
||||
).join(', ');
|
||||
config.RAG_TOKENIZER_MODEL = config?.RAG_TOKENIZER_MODEL ?? '';
|
||||
|
||||
RAGConfig = config;
|
||||
@@ -404,6 +413,17 @@
|
||||
</SettingsSelect>
|
||||
</AdminSettingRow>
|
||||
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Supported Media MIME Types')}
|
||||
description={$i18n.t('Media upload MIME types the content extraction engine may process.')}
|
||||
>
|
||||
<input
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('image/*, video/*')}
|
||||
bind:value={RAGConfig.CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES}
|
||||
/>
|
||||
</AdminSettingField>
|
||||
|
||||
{#if RAGConfig.CONTENT_EXTRACTION_ENGINE === ''}
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('PDF Extract Images (OCR)')}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { getBackendConfig, getVersionUpdates } from '$lib/apis';
|
||||
import { getAdminConfig, updateAdminConfig } from '$lib/apis/auths';
|
||||
import { getBanners, setBanners } from '$lib/apis/configs';
|
||||
import SettingsSelect from '$lib/components/common/SettingsSelect.svelte';
|
||||
import Switch from '$lib/components/common/Switch.svelte';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
import { WEBUI_BUILD_HASH, WEBUI_VERSION } from '$lib/constants';
|
||||
@@ -284,6 +285,24 @@
|
||||
>
|
||||
<Switch bind:state={adminConfig.ENABLE_CHANNELS} ariaLabelledbyId={labelId} />
|
||||
</AdminSettingRow>
|
||||
{#if adminConfig.ENABLE_CHANNELS}
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Model Response Mode')}
|
||||
description={$i18n.t(
|
||||
'Choose where model responses to root-level channel mentions are posted.'
|
||||
)}
|
||||
labelClassName="text-gray-500 dark:text-gray-500"
|
||||
let:labelId
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={adminConfig.CHANNEL_MODEL_RESPONSE_MODE}
|
||||
aria-labelledby={labelId}
|
||||
>
|
||||
<option value="thread">{$i18n.t('Thread')}</option>
|
||||
<option value="channel">{$i18n.t('Channel')}</option>
|
||||
</SettingsSelect>
|
||||
</AdminSettingRow>
|
||||
{/if}
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Calendar')}
|
||||
description={$i18n.t('Allow users to access calendar features.')}
|
||||
|
||||
Reference in New Issue
Block a user