mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-07 08:26:15 +00:00
fix(browser-extension): silence production diagnostics
This commit is contained in:
parent
3a8eae77a1
commit
a88d4d9396
9 changed files with 32 additions and 51 deletions
|
|
@ -232,7 +232,6 @@ export default defineBackground(() => {
|
|||
response.results?.forEach((result, index) => {
|
||||
memories.push(`${index + 1}. ${result.memory} \n`)
|
||||
})
|
||||
console.log("Memories:", memories)
|
||||
await trackEvent(eventSource)
|
||||
return { success: true, data: memories }
|
||||
} catch (error) {
|
||||
|
|
@ -312,9 +311,6 @@ export default defineBackground(() => {
|
|||
platform: string
|
||||
source: string
|
||||
}
|
||||
console.log("=== PROMPT CAPTURED ===")
|
||||
console.log(messageData)
|
||||
console.log("========================")
|
||||
|
||||
const memoryData: MemoryData = {
|
||||
content: messageData.prompt,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ let chatGPTDebounceTimeout: NodeJS.Timeout | null = null
|
|||
let chatGPTRouteObserver: MutationObserver | null = null
|
||||
let chatGPTUrlCheckInterval: NodeJS.Timeout | null = null
|
||||
let chatGPTObserverThrottle: NodeJS.Timeout | null = null
|
||||
const CHATGPT_DEBUG = true
|
||||
const CHATGPT_DEBUG = false
|
||||
const CHATGPT_LOG_PREFIX = "[supermemory:chatgpt]"
|
||||
|
||||
export function initializeChatGPT() {
|
||||
|
|
@ -208,7 +208,9 @@ async function getRelatedMemoriesForChatGPT(actionSource: string) {
|
|||
promptElement,
|
||||
response.data,
|
||||
)
|
||||
console.log("Prompt element dataset:", memoryText)
|
||||
debugChatGPT("memory suggestion rendered", {
|
||||
memoryLength: memoryText.length,
|
||||
})
|
||||
|
||||
iconElement.dataset.memoriesData = String(response.data)
|
||||
|
||||
|
|
@ -348,7 +350,9 @@ async function saveMemoriesToSupermemory() {
|
|||
actionSource: "chatgpt_memories_dialog",
|
||||
})
|
||||
|
||||
console.log({ response })
|
||||
debugChatGPT("memory dialog saved", {
|
||||
success: response.success,
|
||||
})
|
||||
|
||||
if (response.success) {
|
||||
DOMUtils.showToast("success")
|
||||
|
|
@ -685,7 +689,7 @@ function setupChatGPTPromptCapture() {
|
|||
const autoCapture = (await autoCapturePromptsEnabled.getValue()) ?? false
|
||||
|
||||
if (!autoCapture) {
|
||||
console.log("Auto capture prompts is disabled, skipping prompt capture")
|
||||
debugChatGPT("auto prompt capture disabled")
|
||||
return
|
||||
}
|
||||
const promptTextarea = document.getElementById("prompt-textarea")
|
||||
|
|
@ -696,8 +700,11 @@ function setupChatGPTPromptCapture() {
|
|||
}
|
||||
|
||||
if (promptTextarea && promptContent.trim()) {
|
||||
console.log(`ChatGPT prompt submitted via ${source}:`, promptContent)
|
||||
debugChatGPT("prompt submitted", {
|
||||
source,
|
||||
promptLength: promptContent.length,
|
||||
|
||||
})
|
||||
try {
|
||||
await browser.runtime.sendMessage({
|
||||
action: MESSAGE_TYPES.CAPTURE_PROMPT,
|
||||
|
|
|
|||
|
|
@ -396,10 +396,12 @@ async function getRelatedMemoriesForClaude(actionSource: string) {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("Claude query extracted:", userQuery)
|
||||
debugClaude("query extracted", {
|
||||
queryLength: userQuery.length,
|
||||
})
|
||||
|
||||
if (!userQuery.trim()) {
|
||||
console.log("No query text found for Claude")
|
||||
debugClaude("memory search skipped because query is empty")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -438,7 +440,9 @@ async function getRelatedMemoriesForClaude(actionSource: string) {
|
|||
timeoutPromise,
|
||||
])
|
||||
|
||||
console.log("Claude memories response:", response)
|
||||
debugClaude("memory search response", {
|
||||
success: response?.success,
|
||||
})
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
const textareaElement = document.querySelector(
|
||||
|
|
@ -451,7 +455,9 @@ async function getRelatedMemoriesForClaude(actionSource: string) {
|
|||
textareaElement,
|
||||
response.data,
|
||||
)
|
||||
console.log("Text element dataset:", memoryText)
|
||||
debugClaude("memory suggestion rendered", {
|
||||
memoryLength: memoryText.length,
|
||||
})
|
||||
|
||||
iconElement.dataset.memoriesData = String(response.data)
|
||||
|
||||
|
|
@ -670,7 +676,9 @@ async function saveClaudeMemoriesToSupermemory(memoryDialog: HTMLElement) {
|
|||
actionSource: "claude_memories_dialog",
|
||||
})
|
||||
|
||||
console.log({ response })
|
||||
debugClaude("memory dialog saved", {
|
||||
success: response.success,
|
||||
})
|
||||
|
||||
if (response.success) {
|
||||
DOMUtils.showToast("success")
|
||||
|
|
@ -720,7 +728,7 @@ function setupClaudePromptCapture() {
|
|||
const autoCapture = (await autoCapturePromptsEnabled.getValue()) ?? false
|
||||
|
||||
if (!autoCapture) {
|
||||
console.log("Auto capture prompts is disabled, skipping prompt capture")
|
||||
debugClaude("auto prompt capture disabled")
|
||||
return
|
||||
}
|
||||
let promptContent = ""
|
||||
|
|
@ -741,7 +749,10 @@ function setupClaudePromptCapture() {
|
|||
}
|
||||
|
||||
if (promptContent.trim()) {
|
||||
console.log(`Claude prompt submitted via ${source}:`, promptContent)
|
||||
debugClaude("prompt submitted", {
|
||||
source,
|
||||
promptLength: promptContent.length,
|
||||
})
|
||||
|
||||
try {
|
||||
await browser.runtime.sendMessage({
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ let geminiDebounceTimeout: NodeJS.Timeout | null = null
|
|||
let geminiRouteObserver: MutationObserver | null = null
|
||||
let geminiUrlCheckInterval: NodeJS.Timeout | null = null
|
||||
let geminiObserverThrottle: NodeJS.Timeout | null = null
|
||||
const GEMINI_DEBUG = true
|
||||
const GEMINI_DEBUG = false
|
||||
const GEMINI_LOG_PREFIX = "[supermemory:gemini]"
|
||||
|
||||
type GeminiInput = HTMLElement | HTMLTextAreaElement
|
||||
|
|
@ -363,20 +363,6 @@ function getInputText(input: GeminiInput | null): string {
|
|||
return input.innerText || input.textContent || ""
|
||||
}
|
||||
|
||||
function _appendStoredMemories(input: GeminiInput, storedMemories: string) {
|
||||
if (input instanceof HTMLTextAreaElement) {
|
||||
const promptContent = input.value || ""
|
||||
input.value = `${promptContent}${storedMemories}`
|
||||
input.dispatchEvent(new Event("input", { bubbles: true }))
|
||||
return input.value
|
||||
}
|
||||
|
||||
input.appendChild(document.createTextNode(storedMemories))
|
||||
input.dispatchEvent(
|
||||
new InputEvent("input", { bubbles: true, inputType: "insertText" }),
|
||||
)
|
||||
return input.innerText || input.textContent || ""
|
||||
}
|
||||
|
||||
async function getRelatedMemoriesForGemini(actionSource: string) {
|
||||
try {
|
||||
|
|
@ -504,7 +490,7 @@ function setupGeminiPromptCapture() {
|
|||
debugGemini("capture requested", { source, autoCapture })
|
||||
|
||||
if (!autoCapture) {
|
||||
console.log("Auto capture prompts is disabled, skipping prompt capture")
|
||||
debugGemini("auto prompt capture disabled")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ export async function saveMemory(
|
|||
actionSource,
|
||||
})) as APIResponse
|
||||
|
||||
console.log("Response from extension:", response)
|
||||
if (response?.success) {
|
||||
DOMUtils.showToast("success")
|
||||
return response
|
||||
|
|
@ -121,9 +120,6 @@ export function setupStorageListener() {
|
|||
window.location.hostname === "app.supermemory.ai"
|
||||
)
|
||||
) {
|
||||
console.log(
|
||||
"Bearer token and user data is only allowed to be used on localhost or supermemory.ai",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ export function initializeT3() {
|
|||
}
|
||||
|
||||
setTimeout(() => {
|
||||
console.log("Adding supermemory icon to T3 input")
|
||||
addSupermemoryIconToT3Input()
|
||||
setupT3AutoFetch()
|
||||
}, 2000)
|
||||
|
|
@ -55,7 +54,6 @@ function setupT3RouteChangeDetection() {
|
|||
const checkForRouteChange = () => {
|
||||
if (window.location.href !== currentUrl) {
|
||||
currentUrl = window.location.href
|
||||
console.log("T3 route changed, re-adding supermemory icon")
|
||||
setTimeout(() => {
|
||||
addSupermemoryIconToT3Input()
|
||||
setupT3AutoFetch()
|
||||
|
|
@ -183,10 +181,8 @@ async function getRelatedMemoriesForT3(actionSource: string) {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("T3 query extracted:", userQuery)
|
||||
|
||||
if (!userQuery.trim()) {
|
||||
console.log("No query text found for T3")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +213,6 @@ async function getRelatedMemoriesForT3(actionSource: string) {
|
|||
timeoutPromise,
|
||||
])
|
||||
|
||||
console.log("T3 memories response:", response)
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
let textareaElement = null
|
||||
|
|
@ -337,12 +332,10 @@ function updateT3IconFeedback(
|
|||
`
|
||||
|
||||
const memoriesText = iconElement.dataset.memoriesData || ""
|
||||
console.log("Memories text:", memoriesText)
|
||||
const individualMemories = memoriesText
|
||||
.split(/[,\n]/)
|
||||
.map((memory) => memory.trim())
|
||||
.filter((memory) => memory.length > 0 && memory !== ",")
|
||||
console.log("Individual memories:", individualMemories)
|
||||
|
||||
individualMemories.forEach((memory, index) => {
|
||||
const memoryItem = document.createElement("div")
|
||||
|
|
@ -497,7 +490,6 @@ function setupT3PromptCapture() {
|
|||
const autoCapture = (await autoCapturePromptsEnabled.getValue()) ?? false
|
||||
|
||||
if (!autoCapture) {
|
||||
console.log("Auto capture prompts is disabled, skipping prompt capture")
|
||||
return
|
||||
}
|
||||
let promptContent = ""
|
||||
|
|
@ -538,7 +530,6 @@ function setupT3PromptCapture() {
|
|||
}
|
||||
|
||||
if (promptContent.trim()) {
|
||||
console.log(`T3 prompt submitted via ${source}:`, promptContent)
|
||||
|
||||
try {
|
||||
await browser.runtime.sendMessage({
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ export function createRouteDetection(
|
|||
const checkForRouteChange = () => {
|
||||
if (window.location.href !== currentUrl) {
|
||||
currentUrl = window.location.href
|
||||
console.log(`${config.platform} route changed, re-initializing`)
|
||||
setTimeout(config.reinitCallback, 1000)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ export async function captureTwitterTokens(
|
|||
if (authHeader?.value && cookieHeader?.value && csrfHeader?.value) {
|
||||
const tokensAlreadyLogged = await getTokensLogged()
|
||||
if (!tokensAlreadyLogged) {
|
||||
console.log("Twitter auth tokens captured successfully")
|
||||
await setTokensLogged()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,8 +186,6 @@ export class TwitterImporter {
|
|||
if (documents.length > 0) {
|
||||
await saveAllTweets(documents)
|
||||
}
|
||||
console.log("Tweets saved")
|
||||
console.log("Documents:", documents)
|
||||
} catch (error) {
|
||||
console.error("Error saving tweets batch:", error)
|
||||
await this.config.onError(error as Error)
|
||||
|
|
@ -201,8 +199,6 @@ export class TwitterImporter {
|
|||
[]
|
||||
const nextCursor = extractNextCursor(instructions)
|
||||
|
||||
console.log("Next cursor:", nextCursor)
|
||||
console.log("Tweets length:", tweets.length)
|
||||
|
||||
if (nextCursor && tweets.length > 0 && !this.config.isFolderImport) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000)) // Rate limiting
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue