Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

Addresses unresolved code review comments regarding blocking operations, error handling, and resource cleanup.

Async Embedding Generation

Clipboard monitoring was blocked by synchronous OpenAI API calls. Items are now saved immediately; embeddings generate asynchronously and update the database post-insertion:

// Save item immediately without embedding
const id = this.db.addItem(item);
item.id = id;
this.history.unshift(item);

// Generate embedding asynchronously - non-blocking
this.embeddingService.getEmbedding(text)
  .then(embedding => {
    if (embedding?.length > 0) {
      this.db.updateItemEmbedding(id, embedding);
    }
  })
  .catch(error => log.error("Embedding failed:", error));

Error Handling & UX

  • Semantic search: Shows explicit error when API key missing instead of silent failure
  • Settings timeout: Added useEffect cleanup to prevent state updates on unmounted component
  • hasMore state: Resets when new items arrive or search clears

Logging & Database

  • Replaced console.log with electron-log/renderer for production consistency
  • Added updateItemEmbedding() method to DatabaseManager
  • Fixed semantic search to use Buffer format instead of JSON for sqlite-vec compatibility

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 12, 2025 11:32
Co-authored-by: mberrishdev <84536014+mberrishdev@users.noreply.github.com>
Co-authored-by: mberrishdev <84536014+mberrishdev@users.noreply.github.com>
Co-authored-by: mberrishdev <84536014+mberrishdev@users.noreply.github.com>
Copilot AI changed the title [WIP] Integrate better-sqlite3 for clipboard history management fix: resolve async embedding generation and error handling issues Dec 12, 2025
Copilot AI requested a review from mberrishdev December 12, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants