mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
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
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:
parent
680ae1d987
commit
46197bc4a3
2 changed files with 22 additions and 4 deletions
|
@ -29,6 +29,7 @@ const likeart = ref([]);
|
||||||
// Translating logic
|
// Translating logic
|
||||||
const translateText = ref(false);
|
const translateText = ref(false);
|
||||||
const translatedBefore = ref(false);
|
const translatedBefore = ref(false);
|
||||||
|
const traslateFailed = ref(false);
|
||||||
watch(
|
watch(
|
||||||
() => props.applyForTranslation,
|
() => props.applyForTranslation,
|
||||||
(value) => {
|
(value) => {
|
||||||
|
@ -63,6 +64,7 @@ const startTranslating = async (text: string) => {
|
||||||
console.log(translateItem[text]);
|
console.log(translateItem[text]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Translation failed:", error);
|
console.error("Translation failed:", error);
|
||||||
|
traslateFailed.value = true;
|
||||||
translateItem[text] = { translateText: text }; // fallback to original text
|
translateItem[text] = { translateText: text }; // fallback to original text
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -89,6 +91,18 @@ const aiSummary = async () => {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<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
|
<div
|
||||||
class="justify-center align-center text-center flex flex-col md:flex-row flex-wrap"
|
class="justify-center align-center text-center flex flex-col md:flex-row flex-wrap"
|
||||||
>
|
>
|
||||||
|
|
|
@ -24,6 +24,7 @@ interface associAppWindowInterface {
|
||||||
height: string;
|
height: string;
|
||||||
black: boolean;
|
black: boolean;
|
||||||
translatable: boolean;
|
translatable: boolean;
|
||||||
|
translateState: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface minAppWindowInterface {
|
interface minAppWindowInterface {
|
||||||
|
@ -512,9 +513,12 @@ const openNewsSourcePage = async (slug: string, title: string) => {
|
||||||
passedValues.value = null;
|
passedValues.value = null;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
const toggleTranslate = (id: string) => {
|
const toggleTranslate = (windowId: string) => {
|
||||||
console.log("windowId", id);
|
const windowIndex = activeWindows.value.findIndex((w) => w.id === windowId);
|
||||||
applyForTranslation.value = true;
|
if (windowIndex !== -1) {
|
||||||
|
activeWindows.value[windowIndex].translateState =
|
||||||
|
!activeWindows.value[windowIndex].translateState;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const translateAvailable = () => {};
|
const translateAvailable = () => {};
|
||||||
|
@ -691,7 +695,7 @@ onMounted(async () => {
|
||||||
:values="passedValues"
|
:values="passedValues"
|
||||||
:windows="activeWindows"
|
:windows="activeWindows"
|
||||||
@closeWindow="closeWindow"
|
@closeWindow="closeWindow"
|
||||||
:applyForTranslation="applyForTranslation"
|
:applyForTranslation="window.translateState"
|
||||||
:windowTranslateState="window.translatable"
|
:windowTranslateState="window.translatable"
|
||||||
:notLoggedInState="notLoggedInState"
|
:notLoggedInState="notLoggedInState"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue