mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 07:41:02 +08:00
The translating system works? ig, maybe it is just me being a idiot this
entire time. Also you can toggle now (translating system) also maybe the AI summary system works?
This commit is contained in:
parent
680ae1d987
commit
46197bc4a3
@ -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"
|
||||
>
|
||||
|
@ -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"
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user