Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/browser-extension/entrypoints/content/chatgpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async function getRelatedMemoriesForChatGPT(actionSource: string) {
if (response?.success && response?.data) {
const promptElement = document.getElementById("prompt-textarea")
if (promptElement) {
promptElement.dataset.supermemories = `<div>Supermemories of user (only for the reference): ${response.data}</div>`
promptElement.dataset.supermemories = `\n\nSupermemories of user (only for the reference): ${response.data}`
console.log(
"Prompt element dataset:",
promptElement.dataset.supermemories,
Expand Down Expand Up @@ -471,7 +471,7 @@ function updateChatGPTIconFeedback(

const promptElement = document.getElementById("prompt-textarea")
if (promptElement) {
promptElement.dataset.supermemories = `<div>Supermemories of user (only for the reference): ${updatedMemories}</div>`
promptElement.dataset.supermemories = `\n\nSupermemories of user (only for the reference): ${updatedMemories}`
}

content
Expand Down Expand Up @@ -647,7 +647,7 @@ function setupChatGPTPromptCapture() {
promptTextarea &&
!promptContent.includes("Supermemories of user")
) {
promptTextarea.innerHTML = `${promptTextarea.innerHTML} ${storedMemories}`
promptTextarea.appendChild(document.createTextNode(storedMemories))
promptContent = promptTextarea.textContent || ""
}

Expand Down
6 changes: 3 additions & 3 deletions apps/browser-extension/entrypoints/content/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ async function getRelatedMemoriesForClaude(actionSource: string) {
) as HTMLElement

if (textareaElement) {
textareaElement.dataset.supermemories = `<div>Supermemories of user (only for the reference): ${response.data}</div>`
textareaElement.dataset.supermemories = `\n\nSupermemories of user (only for the reference): ${response.data}`
console.log(
"Text element dataset:",
textareaElement.dataset.supermemories,
Expand Down Expand Up @@ -442,7 +442,7 @@ function updateClaudeIconFeedback(
'div[contenteditable="true"]',
) as HTMLElement
if (textareaElement) {
textareaElement.dataset.supermemories = `<div>Supermemories of user (only for the reference): ${updatedMemories}</div>`
textareaElement.dataset.supermemories = `\n\nSupermemories of user (only for the reference): ${updatedMemories}`
}

content
Expand Down Expand Up @@ -520,7 +520,7 @@ function setupClaudePromptCapture() {
contentEditableDiv &&
!promptContent.includes("Supermemories of user")
) {
contentEditableDiv.innerHTML = `${contentEditableDiv.innerHTML} ${storedMemories}`
contentEditableDiv.appendChild(document.createTextNode(storedMemories))
promptContent =
contentEditableDiv.textContent || contentEditableDiv.innerText || ""
}
Expand Down
13 changes: 4 additions & 9 deletions apps/browser-extension/entrypoints/content/t3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,8 @@ async function getRelatedMemoriesForT3(actionSource: string) {
}

if (textareaElement) {
if (textareaElement.tagName === "TEXTAREA") {
;(textareaElement as HTMLTextAreaElement).dataset.supermemories =
`<br>Supermemories of user (only for the reference): ${response.data}</br>`
} else {
;(textareaElement as HTMLElement).dataset.supermemories =
`<br>Supermemories of user (only for the reference): ${response.data}</br>`
}
textareaElement.dataset.supermemories =
`\n\nSupermemories of user (only for the reference): ${response.data}`

iconElement.dataset.memoriesData = response.data

Expand Down Expand Up @@ -450,7 +445,7 @@ function updateT3IconFeedback(
(document.querySelector("textarea") as HTMLTextAreaElement) ||
(document.querySelector('div[contenteditable="true"]') as HTMLElement)
if (textareaElement) {
textareaElement.dataset.supermemories = `<div>Supermemories of user (only for the reference): ${updatedMemories}</div>`
textareaElement.dataset.supermemories = `\n\nSupermemories of user (only for the reference): ${updatedMemories}`
}

content
Expand Down Expand Up @@ -537,7 +532,7 @@ function setupT3PromptCapture() {
`${promptContent} ${storedMemories}`
promptContent = (textareaElement as HTMLTextAreaElement).value
} else {
textareaElement.innerHTML = `${textareaElement.innerHTML} ${storedMemories}`
textareaElement.appendChild(document.createTextNode(storedMemories))
promptContent =
textareaElement.textContent || textareaElement.innerText || ""
}
Expand Down