Files
Project-Thoth/codex/chatgpt-capture-mvp/implementation/0006-user-feedback.md
T

3.6 KiB

Implement Task 6 — User Feedback for the Project Thoth ChatGPT Capture Connector MVP.

Context:

  • Task 3 extracts the ChatGPT conversation.
  • Task 4 normalizes the capture to Markdown.
  • Task 5 downloads the Markdown file to Downloads.
  • This task adds simple user-facing feedback for success and failure states.
  • Keep the implementation lightweight.
  • Do not add AI processing, Project Thoth app integration, vault writes, manifests, metadata generation, or harvest generation.

Goal: Show clear feedback to the user when capture succeeds or fails.

Required user-facing messages:

  1. Success: "Saved to Downloads."

  2. Not on ChatGPT: "Open a ChatGPT conversation before saving to Project Thoth."

  3. No ChatGPT conversation detected: "No ChatGPT conversation was detected on this page."

  4. Capture failed: "Capture failed. Try scrolling through the conversation and capturing again."

  5. Download failed: "The conversation was captured, but the file could not be saved."

Implementation options: Use the simplest reliable feedback mechanism for a Manifest V3 Chrome/Edge extension.

Preferred approach:

  • Use chrome.action.setBadgeText and chrome.action.setTitle for lightweight status feedback.
  • Badge examples:
    • Success: "OK"
    • Error: "ERR"
  • Clear badge text after a short timeout.
  • Also log detailed errors to the service worker console.

Optional approach if already using a popup:

  • Display the same messages in the popup.
  • Do not create a complex UI just for this task unless necessary.

Files to update:

  • src/background.js
  • manifest.json only if required
  • README.md only if behavior/testing instructions need updating

Suggested helper function:

function showStatus(tabId, message, badgeText = "") { chrome.action.setTitle({ tabId, title: message }); chrome.action.setBadgeText({ tabId, text: badgeText });

if (badgeText) { setTimeout(() => { chrome.action.setBadgeText({ tabId, text: "" }); chrome.action.setTitle({ tabId, title: "Save to Project Thoth" }); }, 3000); } }

Behavior requirements:

  1. When the user clicks the toolbar button on a non-ChatGPT page:

    • Do not inject the content script.
    • Show the not-on-ChatGPT message.
    • Log the reason.
  2. When extraction returns no messages:

    • Do not download an empty conversation unless the current architecture already intentionally supports capture notice files.
    • Show the no-conversation-detected message.
    • Log the payload for debugging.
  3. When content script injection or extraction throws:

    • Show the capture-failed message.
    • Log the full error.
  4. When Markdown normalization succeeds but downloads API fails:

    • Show the download-failed message.
    • Log chrome.runtime.lastError if available.
  5. When download succeeds:

    • Show the success message.
    • Log filename and download id.
  6. Keep all user-facing text centralized as constants.

  7. Do not use alert() inside the page unless no extension-native feedback mechanism works.

Acceptance criteria:

  • Success case displays "Saved to Downloads."
  • Non-ChatGPT page displays "Open a ChatGPT conversation before saving to Project Thoth."
  • No detected messages displays "No ChatGPT conversation was detected on this page."
  • Capture/injection failure displays "Capture failed. Try scrolling through the conversation and capturing again."
  • Download failure displays "The conversation was captured, but the file could not be saved."
  • Badge/title feedback clears after a short delay.
  • Console logs contain enough diagnostic information for manual testing.
  • No LLM calls.
  • No Project Thoth application dependency.
  • No vault writes.