feat: non-english youtube support

This commit is contained in:
Timothy J. Baek
2024-05-08 10:47:05 -07:00
parent 87daf122db
commit d3822f782c
4 changed files with 73 additions and 3 deletions

View File

@@ -32,10 +32,16 @@ type ChunkConfigForm = {
chunk_overlap: number;
};
type YoutubeConfigForm = {
language: string[];
translation?: string | null;
};
type RAGConfigForm = {
pdf_extract_images?: boolean;
chunk?: ChunkConfigForm;
web_loader_ssl_verification?: boolean;
youtube?: YoutubeConfigForm;
};
export const updateRAGConfig = async (token: string, payload: RAGConfigForm) => {

View File

@@ -11,9 +11,16 @@
let webLoaderSSLVerification = true;
let youtubeLanguage = 'en';
let youtubeTranslation = null;
const submitHandler = async () => {
const res = await updateRAGConfig(localStorage.token, {
web_loader_ssl_verification: webLoaderSSLVerification
web_loader_ssl_verification: webLoaderSSLVerification,
youtube: {
language: youtubeLanguage.split(',').map((lang) => lang.trim()),
translation: youtubeTranslation
}
});
};
@@ -22,6 +29,8 @@
if (res) {
webLoaderSSLVerification = res.web_loader_ssl_verification;
youtubeLanguage = res.youtube.language.join(',');
youtubeTranslation = res.youtube.translation;
}
});
</script>
@@ -36,7 +45,7 @@
<div class=" space-y-3 pr-1.5 overflow-y-scroll h-full max-h-[22rem]">
<div>
<div class=" mb-1 text-sm font-medium">
{$i18n.t('Retrieval Augmented Generation Settings')}
{$i18n.t('Web Loader Settings')}
</div>
<div>
@@ -61,6 +70,25 @@
</button>
</div>
</div>
<div class=" mt-2 mb-1 text-sm font-medium">
{$i18n.t('Youtube Loader Settings')}
</div>
<div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" w-20 text-xs font-medium self-center">{$i18n.t('Language')}</div>
<div class=" flex-1 self-center">
<input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
type="text"
placeholder={$i18n.t('Enter language codes')}
bind:value={youtubeLanguage}
autocomplete="off"
/>
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-end pt-3 text-sm font-medium">