Skip to content

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Oct 12, 2025

Auto detect

@DOsinga
Copy link
Collaborator Author

DOsinga commented Oct 12, 2025

@spencrmartin - can you use this as the basis for the onboarding? I added the UI in a haphazardly way

@DOsinga
Copy link
Collaborator Author

DOsinga commented Oct 12, 2025

@firstprinciplecode

spencrmartin added a commit that referenced this pull request Oct 30, 2025
- Add auto_detect.rs module for parallel provider testing
- Add /config/detect-provider API endpoint
- Add DetectProviderRequest and DetectProviderResponse structs
- Update OpenAPI specifications
- Backend compiles successfully

Part of PR #4950 + #5147 integration
spencrmartin added a commit that referenced this pull request Oct 30, 2025
- Add ApiKeyTester component calling /config/detect-provider
- Update ProviderGuard with ApiKeyTester in onboarding
- Add provider icons and regenerate API client
- Show progress and results during detection

Integration of PR #4950 + #5147
@spencrmartin spencrmartin mentioned this pull request Oct 30, 2025
9 tasks
spencrmartin added a commit that referenced this pull request Oct 30, 2025
- Replace format-based detection with parallel testing approach
- Test all providers simultaneously using tokio::spawn for better accuracy
- Simplify API response (404 for no match instead of structured errors)
- Remove complex Ollama rejection logic - let parallel testing handle it
- Should properly detect Anthropic, OpenAI, Google, Groq, xAI, and Ollama
- Maintains existing Quick Setup UI with improved backend detection

This integrates the robust parallel testing approach from PR #5147
into our Quick Setup onboarding flow for better API key detection.
spencrmartin added a commit that referenced this pull request Oct 30, 2025
- Add detect_cloud_provider_from_api_key() function that excludes Ollama
- Add /config/detect-cloud-provider endpoint for Quick Setup use
- Update ApiKeyTester to use cloud-only detection endpoint
- Remove frontend Ollama rejection since backend won't return it
- Ensures Quick Setup only works with cloud API providers
- Maintains full detection (including Ollama) for other use cases

This prevents unwanted Ollama fallbacks in Quick Setup while preserving
the parallel testing approach from PR #5147 for better accuracy.
spencrmartin added a commit that referenced this pull request Oct 30, 2025
The pure parallel approach from PR #5147 was testing Anthropic keys against
OpenAI API, causing incorrect rejections. This hybrid approach:

1. Detects key format first (sk-ant- → anthropic)
2. Tests the likely provider first with the key
3. Falls back to parallel testing if format detection fails
4. Includes OpenRouter support (sk-or- format)

This should correctly route sk-ant- keys to Anthropic API for proper validation
while maintaining the robustness of parallel testing for unknown formats.

Benefits:
- Anthropic keys test against Anthropic API (not OpenAI)
- Faster detection (test likely provider first)
- Robust fallback (parallel testing if needed)
- Supports more providers (OpenRouter)
spencrmartin added a commit that referenced this pull request Oct 30, 2025
- Enhanced frontend format detection for all major providers (Anthropic, OpenRouter, OpenAI, Google, Groq, xAI)
- Added smart workarounds for backend parallel testing issues
- Prevent unwanted redirects during API key testing by maintaining userInActiveSetup state
- Reject Ollama fallback in Quick Setup to ensure cloud-only provider detection
- Configure providers directly when backend detection fails but format is recognized
- Use correct model names: claude-3-haiku-20240307 for Anthropic, anthropic/claude-3-haiku for OpenRouter
- Add input validation to prevent console log injection issues
- Provide detailed error messages and suggestions for failed key validation
- Integrate parallel testing approach from PR #5147 with frontend filtering

Fixes the core issue where users entering incorrect API keys would be redirected
away from setup screen, now they stay on setup with clear error feedback.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

This pull request has been automatically marked as stale because it has not had recent activity for 23 days.

What happens next?

  • If no further activity occurs, this PR will be automatically closed in 7 days
  • To keep this PR active, simply add a comment, push new commits, or add the keep-open label
  • If you believe this PR was marked as stale in error, please comment and we'll review it

Thank you for your contribution! 🚀

@github-actions github-actions bot added the stale label Nov 5, 2025
@alexhancock
Copy link
Collaborator

Seems interesting and nice for making it more "works out of the box"

Do we still want to do this one?

@github-actions github-actions bot removed the stale label Nov 7, 2025
@DOsinga
Copy link
Collaborator Author

DOsinga commented Nov 10, 2025

closing, assuming @spencrmartin will integrate this

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