Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

chore: wait for syncing connection with whatsapp

Vanalitee6712ab7d285
diff --git a/src-tauri/src/core/openclaw/commands.rs b/src-tauri/src/core/openclaw/commands.rs
index 29d4eab37..bbffabe31 100644
--- a/src-tauri/src/core/openclaw/commands.rs
+++ b/src-tauri/src/core/openclaw/commands.rs
@@ -2429,14 +2429,23 @@ pub async fn whatsapp_check_auth() -> Result<WhatsAppAuthStatus, String> {
.and_then(|v| v.as_str())
.map(String::from);
- if last_error.is_some() && !linked {
- return Ok(WhatsAppAuthStatus {
- in_progress: false,
- qr_code_ready: false,
- qr_code: None,
- authenticated: false,
- error: last_error,
- });
+ // Only report fatal errors, not transient ones like 515 stream errors
+ // These can occur during connection establishment but the link often succeeds after
+ if let Some(ref err) = last_error {
+ let is_transient = err.contains("515") ||
+ err.contains("restart required") ||
+ err.contains("Stream Errored");
+
+ if !is_transient && !linked {
+ return Ok(WhatsAppAuthStatus {
+ in_progress: false,
+ qr_code_ready: false,
+ qr_code: None,
+ authenticated: false,
+ error: last_error,
+ });
+ }
+ // For transient errors, continue checking - don't report as error yet
}
}
}
diff --git a/web-app/src/containers/dialogs/WhatsAppWizardDialog.tsx b/web-app/src/containers/dialogs/WhatsAppWizardDialog.tsx
index e5626939f..c2f2117ae 100644
--- a/web-app/src/containers/dialogs/WhatsAppWizardDialog.tsx
+++ b/web-app/src/containers/dialogs/WhatsAppWizardDialog.tsx
@@ -174,13 +174,26 @@ export function WhatsAppWizardDialog({
onConnected(whatsappConfig)
}
- // If there's an error, show it
- if (status.error) {
- clearInterval(interval)
- setPollingInterval(null)
- setIsPolling(false)
- setErrorMessage(status.error)
- setStep('error')
+ // If there's an error, check if it's a fatal error or transient
+ // Transient errors (like 515 stream errors) should not stop polling
+ // as the connection often succeeds on retry
+ if (status.error && !status.in_progress) {
+ // Only stop polling if the error is final (not in progress anymore)
+ // Transient errors during connection attempts should be ignored
+ const isFatalError = !status.error.includes('515') &&
+ !status.error.includes('restart required') &&
+ !status.error.includes('Stream Errored');
+
+ if (isFatalError) {
+ clearInterval(interval)
+ setPollingInterval(null)
+ setIsPolling(false)
+ setErrorMessage(status.error)
+ setStep('error')
+ } else {
+ // Transient error, log it but keep polling
+ console.log('Transient WhatsApp error, continuing to poll:', status.error)
+ }
}
} catch (error) {
console.error('Polling error:', error)