The translating system works? ig, maybe it is just me being a idiot this
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run

entire time. Also you can toggle now (translating system) also maybe the
AI summary system works?
This commit is contained in:
yuanhau 2025-06-07 12:00:04 +08:00
parent 680ae1d987
commit 46197bc4a3
2 changed files with 22 additions and 4 deletions

View file

@ -29,6 +29,7 @@ const likeart = ref([]);
// Translating logic
const translateText = ref(false);
const translatedBefore = ref(false);
const traslateFailed = ref(false);
watch(
() => props.applyForTranslation,
(value) => {
@ -63,6 +64,7 @@ const startTranslating = async (text: string) => {
console.log(translateItem[text]);
} catch (error) {
console.error("Translation failed:", error);
traslateFailed.value = true;
translateItem[text] = { translateText: text }; // fallback to original text
}
};
@ -89,6 +91,18 @@ const aiSummary = async () => {
};
</script>
<template>
<div
class="flex flex-col bg-gray-200/50 text-black w-full h-full absolute inset-0 justify-center align-middle text-center z-[20] backdrop-blur-sm"
v-if="traslateFailed"
>
<div class="m-2 flex flex-col">
<span
>Translate Failed. <br />
Oops, your translation failed.</span
>
<button></button>
</div>
</div>
<div
class="justify-center align-center text-center flex flex-col md:flex-row flex-wrap"
>

View file

@ -24,6 +24,7 @@ interface associAppWindowInterface {
height: string;
black: boolean;
translatable: boolean;
translateState: boolean;
}
interface minAppWindowInterface {
@ -512,9 +513,12 @@ const openNewsSourcePage = async (slug: string, title: string) => {
passedValues.value = null;
}, 1000);
};
const toggleTranslate = (id: string) => {
console.log("windowId", id);
applyForTranslation.value = true;
const toggleTranslate = (windowId: string) => {
const windowIndex = activeWindows.value.findIndex((w) => w.id === windowId);
if (windowIndex !== -1) {
activeWindows.value[windowIndex].translateState =
!activeWindows.value[windowIndex].translateState;
}
};
const translateAvailable = () => {};
@ -691,7 +695,7 @@ onMounted(async () => {
:values="passedValues"
:windows="activeWindows"
@closeWindow="closeWindow"
:applyForTranslation="applyForTranslation"
:applyForTranslation="window.translateState"
:windowTranslateState="window.translatable"
:notLoggedInState="notLoggedInState"
/>