Skip to content

Conversation

@croossin
Copy link
Contributor

@croossin croossin commented Oct 5, 2025

Add AI Chat Integration with OpenAI Support

This PR introduces a way for users to chat with AI about any web page. The feature is accessible via CMD + / and includes secure API key management, real-time streaming responses, and intelligent page content analysis.

Features Added

AI Chat Panel

  • Keyboard shortcut CMD + / opens/closes chat panel on the right side
  • Model selection dropdown (GPT-4, GPT-4 Turbo, etc.)

Secure API Key Management (BYOK)

  • API keys stored securely in macOS Keychain (not UserDefaults)
  • New "AI" tab in Settings with provider status and key management
  • Clear provider status indicators and model availability display
CleanShot 2025-10-05 at 10 20 11@2x

Intelligent Page Context

  • Automatically extracts page content (title, description, main text) on first message
  • Only sends page content once per conversation to optimize token usage
  • Robust JavaScript-based content extraction from web pages
  • Debug logging shows extracted content during development

Real-time Streaming Responses

  • Responses stream in word-by-word like modern AI chat interfaces
  • Single message bubble that fills as content streams
  • Graceful error handling for API failures
  • Professional chat experience

Architecture

Provider System

  • Extensible design for adding Claude, Gemini, and other providers
  • Protocol-based abstraction for different AI services
  • Built-in streaming support for real-time responses

Security

  • New KeychainService.swift for secure API key storage
  • Fixed service identifier for consistent keychain access across builds
  • Keys are encrypted and device-bound

UI Integration

  • New AI settings tab with provider management
  • Chat panel integrated into browser's split-view system
  • Consistent animations and styling with existing UI

Dependencies

  • AIProxySwift 0.129.0 for OpenAI API integration with BYOK support
  • Native macOS Keychain Services for secure storage

Demo

CleanShot.2025-10-05.at.10.18.07.mp4

@JohnnWi
Copy link

JohnnWi commented Oct 5, 2025

is possible to add the support gpt 5 nano? And maybe even a setting to adjust the level of reasoning. If this feature is integrated, I think it will be a game change (at least for me)

@versecafe
Copy link
Contributor

@croossin would you have some time to pair on this I'd like to make it much more flexible for cross provider support and I'm not a swift dev but have been doing model routers & multi provider interfaces in production at work for a while.

@Visual-Studio-Coder
Copy link

Ay! We could add the @tabs thing where you can mention other tabs like arc browser did, and we can import skills from Dia, like I did with this extension https://www.raycast.com/Visual-Studio-Coder/dia-skills

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.

4 participants