()
| 257 | }, [quotaInfo, has70PercentWarningBeenShown, onUpgradeClick]); |
| 258 | |
| 259 | const handleToggleObServer = () => { |
| 260 | const newValue = !isUsingObServer; |
| 261 | |
| 262 | if (newValue && !isAuthenticated) { |
| 263 | Logger.warn('AUTH', 'User attempted to enable ObServer while not authenticated.'); |
| 264 | setShowLoginMessage(true); |
| 265 | setTimeout(() => setShowLoginMessage(false), 3000); |
| 266 | return; |
| 267 | } |
| 268 | |
| 269 | // If switching FROM ObServer TO local on official web app, show warning |
| 270 | if (!newValue && hostingContext === 'official-web') { |
| 271 | setIsStartupDialogOpen(true); |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | // Update state and manage inference addresses |
| 276 | if (newValue) { |
| 277 | // Add ObServer immediately |
| 278 | addInferenceAddress(OB_SERVER_ADDRESS); |
| 279 | // Fetch models to include ObServer models |
| 280 | fetchModels(); |
| 281 | // Check quota when turning on ObServer |
| 282 | if (isAuthenticated) { |
| 283 | fetchQuotaInfo(true); // Force check even though state hasn't updated yet |
| 284 | } |
| 285 | } else { |
| 286 | // Remove ObServer |
| 287 | removeInferenceAddress(OB_SERVER_ADDRESS); |
| 288 | // Fetch models to remove ObServer models |
| 289 | fetchModels(); |
| 290 | } |
| 291 | |
| 292 | if (externalSetIsUsingObServer) { |
| 293 | externalSetIsUsingObServer(newValue); |
| 294 | } else { |
| 295 | setInternalIsUsingObServer(newValue); |
| 296 | } |
| 297 | }; |
| 298 | |
| 299 | const checkLocalServer = async () => { |
| 300 | try { |
nothing calls this directly
no test coverage detected