Add API connection detection for custom providers #32
Open
fengcunhan wants to merge 2 commits intoworkany-ai:devfrom
Open
Add API connection detection for custom providers #32fengcunhan wants to merge 2 commits intoworkany-ai:devfrom
fengcunhan wants to merge 2 commits intoworkany-ai:devfrom
Conversation
Add detection button to validate custom API provider configuration before using it for AI agent tasks. Features: - Detection button in both "Add Provider" form and "Edit Provider" panel - Validates baseUrl and apiKey by calling /v1/messages endpoint - Visual feedback: green (success) or red (failure) button styling - 60-second timeout for slow local models - Error messages displayed below button for troubleshooting Backend changes: - POST /providers/detect endpoint for API validation - Refactored providers routes with extracted constants and helper functions - Added type definitions for all request/response bodies - Global error handler for consistent error responses - Extracted formatProviderMetadata() to reduce duplication The detection uses minimal request payload (1 token, "OK" message) to quickly verify API connectivity without consuming credits. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add internationalization support for the API connection detection feature introduced in the previous commit. This ensures proper localization for both Chinese and English users. Frontend changes: - Added tt() interpolation support for dynamic error messages - Replaced hardcoded Chinese text with translation keys - Updated detect button labels (Detecting, Success, Failed) - Localized validation messages and connection status Backend changes: - Standardized API error messages to English - Changed response messages from Chinese to English Translation keys added: - detectConfig, detecting, success, failed - connectionSuccess, connectionFailed - connectionTimeout, networkError - fillBaseUrlAndApiKey, connectionError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add API connection detection for custom providers