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

feat(Gemini): added option to show title #8887

Merged
merged 10 commits into from
Nov 16, 2024
16 changes: 15 additions & 1 deletion websites/G/Gemini/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
"description": {
"en": "Gemini gives you direct access to Google AI. Get help with writing, planning, learning, and more."
},
"contributors": [
{
"name": "Kaktuswerk",
"id": "1167417152664522764"
}
],
"url": "gemini.google.com",
"version": "1.0.7",
"version": "1.1.0",
"logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/thumbnail.png",
"color": "#5286d2",
Expand All @@ -21,5 +27,13 @@
"llm",
"chatbot",
"model"
],
"settings": [
{
"id": "showTitle",
"title": "Show chat title",
"icon": "fa-solid fa-message-quote",
"value": true
}
]
}
21 changes: 19 additions & 2 deletions websites/G/Gemini/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,27 @@ presence.on("UpdateData", async () => {
startTimestamp: browsingTimestamp,
details: "Browsing website",
},
{ pathname } = document.location;
{ pathname } = document.location,
showTitle = await presence.getSetting<boolean>("showTitle");
switch (true) {
case pathname.startsWith("/app"):
presenceData.details = "Asking questions";
// Check the selected conversation
if (showTitle) {
presenceData.details =
document.querySelector(
"div.conversation.selected>div.conversation-title"
).textContent ?? "Thinking of a new Prompt...";

// Show word count
const elem = document.querySelectorAll(
"p.query-text-line,div.response-optimization.markdown"
);
presenceData.state = `Asked ${
elem[0].textContent.split(" ").length
} words | answered with ${
elem[1].textContent.split(" ").length
} words.`;
} else presenceData.details = "Asking questions";
break;
case pathname.startsWith("/extensions"):
presenceData.details = "Managing extensions";
Expand Down
Loading