fix: UX audit improvements - dark theme, structured errors, heartbeat, health check
Phase 1 - UI Theme Consistency: - Chat messages now use consistent dark theme (removed jarring white bg) - Plan cards restyled with rounded borders, fills, colored status badges - Timeline entries use humanist sans-serif instead of monospace - Error messages now structured (icon + title + detail + action link) - Input area unified with dark theme cohesion Phase 2 - UX Flow: - Added contextual placeholder text per agent mode in textarea - Added visual mode indicator badge (Chat/Planning/Writing) - Simplified welcome screen (single 'Continue' + collapsible history) - Added slash command/mention discovery hint in empty input - Added write confirmation when editor has existing content - Added 30s streaming heartbeat (reassurance when model is slow) Phase 3 - Error Handling: - Added DB table health check on sidebar init - Improved 'no API key' error with settings link - Shows in-chat warning when provider fallback triggers - Auto-fallback to registry fallback model on unavailability - isLoading always resets via try/finally pattern
This commit is contained in:
@@ -784,7 +784,21 @@ class WP_Agentic_Writer_OpenRouter_Provider implements WP_Agentic_Writer_AI_Prov
|
||||
// Validate model availability before making API call
|
||||
$model_validation = $this->validate_model_availability( $model );
|
||||
if ( is_wp_error( $model_validation ) ) {
|
||||
return $model_validation;
|
||||
// Auto-fallback: try registry fallback model instead of hard-failing
|
||||
$fallback_model = WPAW_Model_Registry::get_fallback_model( $type );
|
||||
if ( $fallback_model && $fallback_model !== $model ) {
|
||||
$fallback_validation = $this->validate_model_availability( $fallback_model );
|
||||
if ( true === $fallback_validation ) {
|
||||
$model = $fallback_model;
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
||||
error_log( "WPAW: Model unavailable, auto-fallback to: {$fallback_model}" );
|
||||
}
|
||||
} else {
|
||||
return $model_validation;
|
||||
}
|
||||
} else {
|
||||
return $model_validation;
|
||||
}
|
||||
}
|
||||
|
||||
// Build request body.
|
||||
|
||||
Reference in New Issue
Block a user