-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathverify_ollama_ui.py
More file actions
117 lines (101 loc) Β· 4.22 KB
/
Copy pathverify_ollama_ui.py
File metadata and controls
117 lines (101 loc) Β· 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env python3
"""
Quick verification that Ollama appears in UI dropdowns.
Run this to confirm Ollama integration is working.
"""
import sys
from pathlib import Path
# Add project to path
sys.path.insert(0, str(Path(__file__).parent))
def verify_ollama_integration():
"""Verify Ollama appears in all the right places."""
print("\n" + "="*60)
print("OLLAMA UI INTEGRATION VERIFICATION")
print("="*60)
# Test 1: Check if Ollama models can be fetched
print("\n1. Testing Ollama model detection...")
try:
from core.llm_models import fetch_ollama_models, update_ollama_models
models = fetch_ollama_models()
if models:
print(f" β
Found {len(models)} Ollama models:")
for model in models:
print(f" - {model}")
else:
print(" β οΈ No Ollama models detected")
print(" Make sure Ollama is running: sudo systemctl status ollama")
print(" Install models with: ollama pull <model-name>")
except Exception as e:
print(f" β Error: {e}")
return False
# Test 2: Check if Ollama appears in LLM provider list
print("\n2. Testing LLM provider list...")
try:
from core.llm_models import get_all_provider_ids, get_provider_display_name
provider_ids = get_all_provider_ids()
if 'ollama' in provider_ids:
print(" β
'ollama' found in provider IDs")
display_name = get_provider_display_name('ollama')
print(f" Display name: '{display_name}'")
else:
print(" β 'ollama' NOT in provider IDs")
print(f" Available: {provider_ids}")
return False
except Exception as e:
print(f" β Error: {e}")
return False
# Test 3: Simulate what the Generate tab dropdown shows
print("\n3. Testing Generate tab LLM dropdown...")
try:
from core.llm_models import get_all_provider_ids, get_provider_display_name
# This is exactly what MainWindow.get_llm_providers() does
provider_names = [get_provider_display_name(pid) for pid in get_all_provider_ids()]
dropdown_items = ["None"] + provider_names
if "Ollama" in dropdown_items:
index = dropdown_items.index("Ollama")
print(f" β
'Ollama' appears at position {index}")
print(" Full dropdown list:")
for i, item in enumerate(dropdown_items):
marker = " β HERE!" if item == "Ollama" else ""
print(f" {i}. {item}{marker}")
else:
print(" β 'Ollama' NOT in dropdown")
print(f" Dropdown shows: {dropdown_items}")
return False
except Exception as e:
print(f" β Error: {e}")
return False
# Test 4: Check if OllamaProvider can be imported
print("\n4. Testing OllamaProvider class...")
try:
from providers.ollama import OllamaProvider
print(" β
OllamaProvider imported successfully")
# Test initialization
provider = OllamaProvider({"endpoint": "http://localhost:11434"})
print(" β
Provider initialized")
# Test model detection
models = provider.get_models()
if models:
print(f" β
Provider detected {len(models)} models")
else:
print(" β οΈ Provider initialized but no models detected")
except Exception as e:
print(f" β Error: {e}")
import traceback
traceback.print_exc()
return False
# Summary
print("\n" + "="*60)
print("VERIFICATION COMPLETE")
print("="*60)
print("\nβ
Ollama integration is working correctly!")
print("\nWHERE TO FIND OLLAMA IN THE UI:")
print(" 1. Generate Tab β 'LLM Provider:' dropdown β Select 'Ollama'")
print(" 2. Video Tab β 'LLM Provider:' dropdown β Select 'Ollama'")
print(" 3. Layout Tab β LLM provider dropdown β Select 'Ollama'")
print("\nNOTE: Ollama will NOT appear in 'Image Provider:' dropdown")
print(" (Ollama models cannot generate images, only text)")
return True
if __name__ == "__main__":
success = verify_ollama_integration()
sys.exit(0 if success else 1)