Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 3 additions & 70 deletions ui/desktop/src/components/ProviderGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import WelcomeGooseLogo from './WelcomeGooseLogo';
import { initializeSystem } from '../utils/providerUtils';
import { toastService } from '../toasts';
import { OllamaSetup } from './OllamaSetup';
import { checkOllamaStatus } from '../utils/ollamaDetection';

import { Goose } from './icons/Goose';
import { OpenRouter, Ollama } from './icons';
import { OpenRouter } from './icons';

interface ProviderGuardProps {
children: React.ReactNode;
Expand All @@ -23,7 +23,7 @@ export default function ProviderGuard({ children }: ProviderGuardProps) {
const [hasProvider, setHasProvider] = useState(false);
const [showFirstTimeSetup, setShowFirstTimeSetup] = useState(false);
const [showOllamaSetup, setShowOllamaSetup] = useState(false);
const [ollamaDetected, setOllamaDetected] = useState(false);

const [openRouterSetupState, setOpenRouterSetupState] = useState<{
show: boolean;
title: string;
Expand Down Expand Up @@ -194,8 +194,6 @@ export default function ProviderGuard({ children }: ProviderGuardProps) {
console.log('ProviderGuard - No provider/model configured');
setShowFirstTimeSetup(true);
}
const ollamaStatus = await checkOllamaStatus();
setOllamaDetected(ollamaStatus.isRunning);
} catch (error) {
// On error, assume no provider and redirect to welcome
console.error('Error checking provider configuration:', error);
Expand All @@ -209,23 +207,6 @@ export default function ProviderGuard({ children }: ProviderGuardProps) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [read]);

// Poll for Ollama status while the first time setup is shown
useEffect(() => {
if (!showFirstTimeSetup) return;

const checkOllama = async () => {
const status = await checkOllamaStatus();
setOllamaDetected(status.isRunning);
};

// Check every 3 seconds
const interval = window.setInterval(checkOllama, 3000);

return () => {
window.clearInterval(interval);
};
}, [showFirstTimeSetup]);

if (
isChecking &&
!openRouterSetupState?.show &&
Expand Down Expand Up @@ -428,54 +409,6 @@ export default function ProviderGuard({ children }: ProviderGuardProps) {
enter your own keys.
</p>
</div>

{/* Ollama Card - outline style */}
<div className="relative">
{/* Detected badge - similar to recommended but green */}
{ollamaDetected && (
<div className="absolute -top-2 -right-2 sm:-top-3 sm:-right-3 z-20">
<span className="inline-block px-2 py-1 text-xs font-medium bg-green-600 text-white rounded-full">
Detected
</span>
</div>
)}

<div
onClick={() => {
setShowFirstTimeSetup(false);
setShowOllamaSetup(true);
}}
className="w-full p-4 sm:p-6 bg-transparent border border-background-hover rounded-xl hover:border-text-muted transition-all duration-200 cursor-pointer group"
>
<div className="flex items-start justify-between mb-3">
<div className="flex-1">
<Ollama className="w-5 h-5 sm:w-6 sm:h-6 mb-12 text-text-standard" />
<h3 className="font-medium text-text-standard text-sm sm:text-base">
Ollama
</h3>
</div>
<div className="text-text-muted group-hover:text-text-standard transition-colors flex-shrink-0">
<svg
className="w-4 h-4 sm:w-5 sm:h-5"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M9 5l7 7-7 7"
/>
</svg>
</div>
</div>
<p className="text-text-muted text-sm sm:text-base">
Advanced: Run AI models locally on your computer. Completely free and private
with no internet required. (Does require significant hardware)
</p>
</div>
</div>
</div>
</div>
</div>
Expand Down