debug llm
This commit is contained in:
parent
ea06a84b31
commit
a96da92704
1 changed files with 14 additions and 0 deletions
|
|
@ -1158,6 +1158,11 @@ Falls ein Feld nicht erkennbar ist, setze den Wert auf null.</textarea>
|
||||||
return;
|
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...');
|
_setStatus('processing', 'Analysiere...');
|
||||||
_setLoading(true);
|
_setLoading(true);
|
||||||
_hideError();
|
_hideError();
|
||||||
|
|
@ -1165,6 +1170,7 @@ Falls ein Feld nicht erkennbar ist, setze den Wert auf null.</textarea>
|
||||||
try {
|
try {
|
||||||
// Get Ollama model name from PowerOn name
|
// Get Ollama model name from PowerOn name
|
||||||
const ollamaModelName = _getOllamaModelName(modelName.value);
|
const ollamaModelName = _getOllamaModelName(modelName.value);
|
||||||
|
console.log('Ollama model name:', ollamaModelName);
|
||||||
|
|
||||||
// Model-specific context lengths
|
// Model-specific context lengths
|
||||||
const modelContextLengths = {
|
const modelContextLengths = {
|
||||||
|
|
@ -1184,24 +1190,32 @@ Falls ein Feld nicht erkennbar ist, setze den Wert auf null.</textarea>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('Sending request to:', `${ollamaUrl.value}/api/generate`);
|
||||||
|
console.log('Request body (without prompt):', { ...requestBody, prompt: '[TRUNCATED]' });
|
||||||
|
|
||||||
// Bild nur hinzufügen wenn vorhanden
|
// Bild nur hinzufügen wenn vorhanden
|
||||||
if (currentImageBase64) {
|
if (currentImageBase64) {
|
||||||
requestBody.images = [currentImageBase64];
|
requestBody.images = [currentImageBase64];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Ollama API directly
|
// Call Ollama API directly
|
||||||
|
console.log('Fetching from Ollama...');
|
||||||
const response = await fetch(`${ollamaUrl.value}/api/generate`, {
|
const response = await fetch(`${ollamaUrl.value}/api/generate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(requestBody)
|
body: JSON.stringify(requestBody)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('Response status:', response.status);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorText = await response.text();
|
const errorText = await response.text();
|
||||||
|
console.error('Ollama error:', errorText);
|
||||||
throw new Error(`Ollama Fehler: ${response.status} - ${errorText.substring(0, 200)}`);
|
throw new Error(`Ollama Fehler: ${response.status} - ${errorText.substring(0, 200)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
console.log('Ollama response received:', result);
|
||||||
const responseText = result.response || '';
|
const responseText = result.response || '';
|
||||||
|
|
||||||
// Try to extract JSON from response
|
// Try to extract JSON from response
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue