From 6561e2dd09aafd68f1ae9c97cd11d0a2842368ea Mon Sep 17 00:00:00 2001 From: Egor Date: Wed, 3 Dec 2025 18:03:31 -0800 Subject: [PATCH] increase frontend additional time-to-start time to 3 secs because windows is slow, better handling of rate limiting tunnel errors --- src/components/App/index.tsx | 2 +- src/main/modules/koboldcpp/tunnel.ts | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index a09bee9..040a28a 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -66,7 +66,7 @@ export const App = () => { setTimeout(() => { setIsServerReady(true); setActiveInterfaceTab(defaultInterfaceTab); - }, 1000); + }, 3000); }); return cleanup; diff --git a/src/main/modules/koboldcpp/tunnel.ts b/src/main/modules/koboldcpp/tunnel.ts index ba5dffd..7832147 100644 --- a/src/main/modules/koboldcpp/tunnel.ts +++ b/src/main/modules/koboldcpp/tunnel.ts @@ -38,15 +38,23 @@ export const startTunnel = async ( } const tunnelTarget = getTunnelTarget(frontendPreference); - const tunnel = Tunnel.quick(tunnelTarget, { - '--no-autoupdate': true, - }); - + const tunnel = Tunnel.quick(tunnelTarget, { '--no-autoupdate': true }); activeTunnel = tunnel; + let rateLimited = false; + + tunnel.on('stderr', (data: string) => { + if (data.includes('429') || data.includes('Too Many Requests')) { + rateLimited = true; + } + }); + const url = await new Promise((resolve, reject) => { const timeout = setTimeout(() => { - reject(new Error('Tunnel connection timed out')); + const message = rateLimited + ? 'Cloudflare rate limit exceeded. Please wait a few minutes and try again.' + : 'Tunnel connection timed out'; + reject(new Error(message)); }, 30000); tunnel.once('url', (url) => { @@ -64,7 +72,7 @@ export const startTunnel = async ( sendKoboldOutput(`Tunnel ready at ${tunnelUrl}`); sendToRenderer('tunnel-url-changed', tunnelUrl); - tunnel.on('error', (error) => { + tunnel.on('error', (error: Error) => { logError(`Tunnel error: ${error.message}`, error); sendKoboldOutput(`Tunnel error: ${error.message}`); });