diff --git a/templates/index.html b/templates/index.html index 4157e0f..ebed3aa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1158,6 +1158,11 @@ Falls ein Feld nicht erkennbar ist, setze den Wert auf null. return; } + console.log('=== ANALYZE BUTTON CLICKED ==='); + console.log('Selected model:', modelName.value); + console.log('Has image:', !!currentImageBase64); + console.log('Prompt length:', promptInput.value.length); + _setStatus('processing', 'Analysiere...'); _setLoading(true); _hideError(); @@ -1165,6 +1170,7 @@ Falls ein Feld nicht erkennbar ist, setze den Wert auf null. try { // Get Ollama model name from PowerOn name const ollamaModelName = _getOllamaModelName(modelName.value); + console.log('Ollama model name:', ollamaModelName); // Model-specific context lengths const modelContextLengths = { @@ -1184,24 +1190,32 @@ Falls ein Feld nicht erkennbar ist, setze den Wert auf null. } }; + console.log('Sending request to:', `${ollamaUrl.value}/api/generate`); + console.log('Request body (without prompt):', { ...requestBody, prompt: '[TRUNCATED]' }); + // Bild nur hinzufügen wenn vorhanden if (currentImageBase64) { requestBody.images = [currentImageBase64]; } // Call Ollama API directly + console.log('Fetching from Ollama...'); const response = await fetch(`${ollamaUrl.value}/api/generate`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(requestBody) }); + console.log('Response status:', response.status); + if (!response.ok) { const errorText = await response.text(); + console.error('Ollama error:', errorText); throw new Error(`Ollama Fehler: ${response.status} - ${errorText.substring(0, 200)}`); } const result = await response.json(); + console.log('Ollama response received:', result); const responseText = result.response || ''; // Try to extract JSON from response