Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modal fix #386

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion extensions/src/textClassification/ImportExport.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
extension.buildCustomDeepModel();
close();
};

const _close = async () => {
if (file) {
const success = await extension.importClassifier(file);
if (!success) close();
extension.buildCustomDeepModel();
}
close();
}
</script>

<div style:background-color={color.ui.white}>
Expand All @@ -33,7 +42,7 @@
on:change={(e) => (file = e.currentTarget.files[0])}
/>
</PrimaryButton>
<PrimaryButton on:click={close}>Done</PrimaryButton>
<PrimaryButton on:click={_close}>Done</PrimaryButton>
</div>

<style>
Expand Down
4 changes: 2 additions & 2 deletions extensions/src/textClassification/services/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const getTranslationToEnglish = async (words: string) => {
if (cachedTranslations.has(words)) return cachedTranslations.get(words);
const endpoint = getTranslationURL({ language: "en", text: encodeURIComponent(words) });
try {
const json: { result: string } = await (await fetchWithTimeout(endpoint, { timeoutMs: 30 })).json();
const translated = json.result;
const json: { result: string } = await (await fetchWithTimeout(endpoint, { timeoutMs: 1000 })).json();
const translated = json.result.replaceAll("%20", " ");
cachedTranslations.set(words, translated);
return translated;
}
Expand Down
Loading