I've developed a Zotero translator for saving Gemini Chat conversations . The translator works partially but has a critical bug with snapshot capture:
Current Behavior:
First save works correctly - captures URL, title, and snapshot properly
Subsequent saves on different chat pages:
Correctly captures new URL and title
But the saved snapshot remains from the first/previous conversation
Expected Behavior:
Each save should capture:
The current page's URL
The current conversation's title
A snapshot of the current conversation content
Technical Details:
The translator uses item.attachments.push() with document: doc and snapshot: true
While the doc parameter changes (verified via URL/title updates), the snapshot remains stale
This suggests Zotero might be caching the document object or not refreshing it between saves
I also use Zotero.debug to show doc, and doc has already changed, but not changes when save the attachment.
Reproduction Steps:
Open chat A on Gemini, save to Zotero (works correctly)
Open chat B (different conversation), save to Zotero
Observe:
URL and title reflect chat B
Snapshot content shows chat A
Environment:
Zotero 7 + Connector, Chrome, Windows 11
Gemini Chat website, DeepSeek
Translator code provided below
async function findConversationTitle(doc) {
let title = null;
let titleElement = doc.querySelector(".selected").querySelector(".conversation-title");
if (titleElement && titleElement.innerText.trim()) {
title = titleElement.outerText.trim();
Zotero.debug("Found title using .selected: " + title);
return title;
}
title = doc.title || "Gemini Conversation";
return title;
}
function detectWeb(doc, url) {
if (url && url.includes("
gemini.google.com/app/")) {
return "report";
}
return false;
}
async function doWeb(doc, url) {
var item = new Zotero.Item("report");
item.url = url;
Zotero.debug("Set item URL: " + item.url);
item.title = await findConversationTitle(doc);
Zotero.debug("Set item title: " + item.title);
item.accessDate = 'CURRENT_TIMESTAMP';
item.websiteTitle = item.title + " - Google Gemini";
item.creators.push({ creatorType: "author", firstName: "Gemini", lastName: "Google" });
item.attachments.push({
document: doc,
title: "Gemini Conversation Snapshot",
mimeType: "text/html",
snapshot: true
});
item.complete();
}