mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Push translate system?
This commit is contained in:
parent
028b545374
commit
b356afe766
4 changed files with 39 additions and 4 deletions
|
@ -85,11 +85,17 @@ const aiSummary = async () => {
|
||||||
>
|
>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<h2 class="text-3xl text-bold">{{ data.title }}</h2>
|
<h2 class="text-3xl text-bold">
|
||||||
|
{{ translateText ? translateItem[data.title] : data.title }}
|
||||||
|
</h2>
|
||||||
<span
|
<span
|
||||||
class="text-lg text-bold flex flex-row justify-center text-center align-center"
|
class="text-lg text-bold flex flex-row justify-center text-center align-center"
|
||||||
><NewspaperIcon class="w-7 h-7 p-1" />{{ data.origin }} •
|
><NewspaperIcon class="w-7 h-7 p-1" />{{
|
||||||
<UserIcon class="w-7 h-7 p-1" />{{ data.author }}</span
|
translateText ? translateItem[data.origin] : data.origin
|
||||||
|
}}
|
||||||
|
• <UserIcon class="w-7 h-7 p-1" />{{
|
||||||
|
translateText ? translateItem[data.author] : data.author
|
||||||
|
}}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-4 w-full h-fit pt-0 mt-0">
|
<div class="p-4 w-full h-fit pt-0 mt-0">
|
||||||
|
|
|
@ -23,6 +23,7 @@ interface associAppWindowInterface {
|
||||||
width: string;
|
width: string;
|
||||||
height: string;
|
height: string;
|
||||||
black: boolean;
|
black: boolean;
|
||||||
|
translatable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface minAppWindowInterface {
|
interface minAppWindowInterface {
|
||||||
|
@ -34,6 +35,7 @@ interface minAppWindowInterface {
|
||||||
width: string;
|
width: string;
|
||||||
height: string;
|
height: string;
|
||||||
black: boolean;
|
black: boolean;
|
||||||
|
translatable: boolean;
|
||||||
lastpositionw: string;
|
lastpositionw: string;
|
||||||
lastpositionh: string;
|
lastpositionh: string;
|
||||||
}
|
}
|
||||||
|
@ -347,6 +349,7 @@ const findAndOpenWindow = (windowName: string, windowTitle?: string) => {
|
||||||
width: app.width || "600px",
|
width: app.width || "600px",
|
||||||
height: app.height || "400px",
|
height: app.height || "400px",
|
||||||
black: app.black || false,
|
black: app.black || false,
|
||||||
|
translatable: app.translatable || false,
|
||||||
});
|
});
|
||||||
currentOpenAppId.value++;
|
currentOpenAppId.value++;
|
||||||
// Add to navbar
|
// Add to navbar
|
||||||
|
@ -418,6 +421,7 @@ const toggleMinWindow = (windowUUId: string) => {
|
||||||
width: activeWindow.width,
|
width: activeWindow.width,
|
||||||
height: activeWindow.height,
|
height: activeWindow.height,
|
||||||
black: activeWindow.black || false,
|
black: activeWindow.black || false,
|
||||||
|
translatable: activeWindow.translatable || false,
|
||||||
lastpositionw: "",
|
lastpositionw: "",
|
||||||
lastpositionh: "",
|
lastpositionh: "",
|
||||||
});
|
});
|
||||||
|
@ -512,6 +516,7 @@ const toggleTranslate = (id: string) => {
|
||||||
console.log("windowId", id);
|
console.log("windowId", id);
|
||||||
applyForTranslation.value = true;
|
applyForTranslation.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const translateAvailable = () => {};
|
const translateAvailable = () => {};
|
||||||
|
|
||||||
// Load user config via HTTP requests to the server.
|
// Load user config via HTTP requests to the server.
|
||||||
|
|
|
@ -17,5 +17,14 @@ export default defineEventHandler(async (event) => {
|
||||||
error: "ERR_NOT_USER_LOGIN",
|
error: "ERR_NOT_USER_LOGIN",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const checkUser = await sql``;
|
const verifyUserToken = await sql`
|
||||||
|
SELECT * FROM usertokens
|
||||||
|
where token=${readUserToken}
|
||||||
|
`;
|
||||||
|
if (verifyUserToken.length === 0) {
|
||||||
|
return {
|
||||||
|
error: "ERR_NOT_USER_LOGIN",
|
||||||
|
requested_action: "LOGOUT_USER",
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
15
server/api/user/loadInfo.ts
Normal file
15
server/api/user/loadInfo.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Fixed data for testing
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
return {
|
||||||
|
langPref: "en",
|
||||||
|
doNotShowLangPrefPopUp: false,
|
||||||
|
email: "test@yuanhau.com",
|
||||||
|
name: "Howard",
|
||||||
|
useCustomGroqKey: true,
|
||||||
|
translate: {
|
||||||
|
enabled: true,
|
||||||
|
lang: "en",
|
||||||
|
provider: "google", // Default provider
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue