Merge pull request #12806 from tth37/fix_web_rag_settings

fix: Resolve small bugs on updated web/rag settings
This commit is contained in:
Tim Jaeryang Baek 2025-04-12 22:26:04 -07:00 committed by GitHub
commit 8e810e758d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 7 deletions

View File

@ -621,8 +621,8 @@ async def update_rag_config(
# Integration settings # Integration settings
request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION = ( request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION = (
form_data.enable_google_drive_integration form_data.ENABLE_GOOGLE_DRIVE_INTEGRATION
if form_data.enable_google_drive_integration is not None if form_data.ENABLE_GOOGLE_DRIVE_INTEGRATION is not None
else request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION else request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION
) )
request.app.state.config.ENABLE_ONEDRIVE_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 = ( request.app.state.config.YOUTUBE_LOADER_PROXY_URL = (
form_data.web.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 form_data.web.YOUTUBE_LOADER_TRANSLATION
) )

View File

@ -46,11 +46,21 @@
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST = []; 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, { const res = await updateRAGConfig(localStorage.token, {
web: webConfig 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 () => { onMount(async () => {
@ -61,8 +71,7 @@
// Convert array back to comma-separated string for display // Convert array back to comma-separated string for display
if (webConfig?.WEB_SEARCH_DOMAIN_FILTER_LIST) { if (webConfig?.WEB_SEARCH_DOMAIN_FILTER_LIST) {
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(','); webConfig.YOUTUBE_LOADER_LANGUAGE = webConfig.YOUTUBE_LOADER_LANGUAGE.join(',');
@ -524,7 +533,6 @@
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 p-1 text-xs bg-transparent outline-hidden text-right" 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} bind:value={webConfig.WEB_LOADER_ENGINE}
placeholder={$i18n.t('Select a engine')} placeholder={$i18n.t('Select a engine')}
required
> >
<option value="">{$i18n.t('Default')}</option> <option value="">{$i18n.t('Default')}</option>
{#each webLoaderEngines as engine} {#each webLoaderEngines as engine}