fix: small bugs on updated web/rag settings

This commit is contained in:
tth37 2025-04-13 12:55:50 +08:00
parent 8d62cc1935
commit 8d53f1e770
2 changed files with 15 additions and 6 deletions

View File

@ -621,8 +621,8 @@ async def update_rag_config(
# Integration settings
request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION = (
form_data.enable_google_drive_integration
if form_data.enable_google_drive_integration is not None
form_data.ENABLE_GOOGLE_DRIVE_INTEGRATION
if form_data.ENABLE_GOOGLE_DRIVE_INTEGRATION is not None
else request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION
)
request.app.state.config.ENABLE_ONEDRIVE_INTEGRATION = (
@ -706,7 +706,7 @@ async def update_rag_config(
request.app.state.config.YOUTUBE_LOADER_PROXY_URL = (
form_data.web.YOUTUBE_LOADER_PROXY_URL
)
request.app.state.config.YOUTUBE_LOADER_TRANSLATION = (
request.app.state.YOUTUBE_LOADER_TRANSLATION = (
form_data.web.YOUTUBE_LOADER_TRANSLATION
)

View File

@ -46,11 +46,21 @@
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST = [];
}
// Convert Youtube loader language string to array before sending
if (webConfig.YOUTUBE_LOADER_LANGUAGE) {
webConfig.YOUTUBE_LOADER_LANGUAGE = webConfig.YOUTUBE_LOADER_LANGUAGE.split(',')
.map((lang) => lang.trim())
.filter((lang) => lang.length > 0);
} else {
webConfig.YOUTUBE_LOADER_LANGUAGE = [];
}
const res = await updateRAGConfig(localStorage.token, {
web: webConfig
});
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST = webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST.join(', ');
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST = webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST.join(',');
webConfig.YOUTUBE_LOADER_LANGUAGE = webConfig.YOUTUBE_LOADER_LANGUAGE.join(',');
};
onMount(async () => {
@ -62,7 +72,7 @@
// Convert array back to comma-separated string for display
if (webConfig?.WEB_SEARCH_DOMAIN_FILTER_LIST) {
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST =
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST.join(', ');
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST.join(',');
}
webConfig.YOUTUBE_LOADER_LANGUAGE = webConfig.YOUTUBE_LOADER_LANGUAGE.join(',');
@ -524,7 +534,6 @@
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 p-1 text-xs bg-transparent outline-hidden text-right"
bind:value={webConfig.WEB_LOADER_ENGINE}
placeholder={$i18n.t('Select a engine')}
required
>
<option value="">{$i18n.t('Default')}</option>
{#each webLoaderEngines as engine}