-
-
Notifications
You must be signed in to change notification settings - Fork 521
feat: implement enhanced authentication system for AI providers #943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: implement enhanced authentication system for AI providers #943
Conversation
- Add feature flags for whisper-cuda and whisper-cpu in Cargo.toml - Create separate tauri.cuda.conf.json with Blinko(CUDA) product name - Implement conditional compilation for voice module based on features - Add is_cuda_available command for frontend CUDA detection - Update GitHub Actions workflows for matrix builds (cpu/cuda variants) - Add CUDA availability check in voice settings UI - Configure conditional voice module loading in lib.rs and setup.rs
Docs: update French translation of todo to Tâches instead of Procuration
- Add 250ms delay activation constraint for mouse and touch sensors - Consolidate all drag logic into dedicated useDragCard hook - Remove drag functionality from BlinkoCard component - Implement stable drag with placeholder and insertion line - Add multi-language support for dragging state - Fix text selection conflicts with long-press approach - Improve masonry layout stability during drag operations
Add comprehensive authentication support for custom AI providers, addressing limitations with the previous API key-only system. ### Key Features: - Multiple authentication types: Bearer token, API key, custom headers, no auth - Flexible header configuration for complex authentication scenarios - Backward compatibility with existing provider configurations - Enhanced UI with example configurations for common providers - Support for Zhipu AI, Moonshot AI, and other custom providers ### Changes: #### Backend: - `server/aiServer/authTypes.ts`: Authentication types and utilities - `server/aiServer/providers/EmbeddingProvider.ts`: Enhanced with custom auth - `server/aiServer/providers/LLMProvider.ts`: Enhanced with custom auth - `server/routerTrpc/ai.ts`: Updated test connection and API endpoints #### Frontend: - `app/src/components/BlinkoSettings/AiSetting/AuthenticationConfig.tsx`: New auth UI component - `app/src/components/BlinkoSettings/AiSetting/ProviderDialogContent.tsx`: Enhanced provider dialog - `app/src/store/aiSettingStore.tsx`: Enhanced store with auth support - `app/public/locales/en/translation.json`: Updated translations #### Documentation: - `docs/ENHANCED_AUTHENTICATION.md`: Comprehensive usage guide ### Technical Details: - Authentication config stored in provider.config.authConfig JSON field - Custom fetch functions inject authentication headers - Graceful fallback to legacy authentication for existing providers - Input validation and error handling for security 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
| updateConfig({ customHeaders: newHeaders }); | ||
| }; | ||
|
|
||
| const renderBearerConfig = () => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I learned that rendering by function could create problems when rerendering.
Instead, the best practice is to create a React component.
Simply like this:
| const renderBearerConfig = () => ( | |
| const BearerConfig = <div... |
To then use it with:
{localConfig.type === 'bearer' && <BearerConfig/>}
| <Icon icon="hugeicons:settings-03" width="16" height="16" /> | ||
| <div> | ||
| <div className="font-medium">Custom Headers</div> | ||
| <div className="text-xs text-default-500">Full control over headers</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation should certainly be provided for these descriptions and labels
| </div> | ||
| ))} | ||
|
|
||
| <div className="flex items-center gap-2"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have put a <form here, and passed the button to submit type
| <div className="flex items-center gap-2"> | |
| <form onSubmit={addCustomHeader} className="flex items-center gap-2"> |
| const baseURL = config.baseURL; | ||
|
|
||
| switch (config.provider.toLowerCase()) { | ||
| case 'openai': | ||
| return createOpenAI({ | ||
| apiKey: config.apiKey, | ||
| baseURL: config.baseURL || undefined, | ||
| apiKey: apiKey, | ||
| baseURL: baseURL || undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also have added || undefined in the const.
const baseURL = config.baseURL || undefined;
switch (config.provider.toLowerCase()) {
case 'openai':
return createOpenAI({
apiKey,
baseURL,
|
That's cool what you're suggesting, it will answer my request for improvement : #818 |
Add comprehensive authentication support for custom AI providers, addressing limitations with the previous API key-only system.
Key Features:
Changes:
Backend:
server/aiServer/authTypes.ts: Authentication types and utilitiesserver/aiServer/providers/EmbeddingProvider.ts: Enhanced with custom authserver/aiServer/providers/LLMProvider.ts: Enhanced with custom authserver/routerTrpc/ai.ts: Updated test connection and API endpointsFrontend:
app/src/components/BlinkoSettings/AiSetting/AuthenticationConfig.tsx: New auth UI componentapp/src/components/BlinkoSettings/AiSetting/ProviderDialogContent.tsx: Enhanced provider dialogapp/src/store/aiSettingStore.tsx: Enhanced store with auth supportapp/public/locales/en/translation.json: Updated translationsDocumentation:
docs/ENHANCED_AUTHENTICATION.md: Comprehensive usage guideTechnical Details:
🤖 Generated with Claude Code