Skip to content

Commit ae6a544

Browse files
Merge pull request #668 from transformerlab/fix/fix-no-ollama-but-still-ollama
Fixed Terminal error if you try to import models and don't have Ollama installed
2 parents 9f4217e + 02492f0 commit ae6a544

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

transformerlab/models/ollamamodel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
async def list_models():
1414
try:
1515
ollama_model_library = ollama_models_library_dir()
16+
except FileNotFoundError:
17+
print("Skipping Ollama models: manifests directory not found")
18+
return []
1619
except Exception as e:
1720
print("Failed to locate Ollama models library:")
1821
print(str(e))

transformerlab/routers/tasks.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,6 @@ async def get_task_file_content(task_dir: str, file_path: str):
619619
return {"status": "error", "message": "An error occurred while getting task file content"}
620620

621621

622-
623-
624622
@router.post("/install_from_gallery", summary="Install a task from transformerlab/galleries to local tasks-gallery")
625623
async def install_task_from_gallery(
626624
id: str = Form(...),
@@ -958,9 +956,7 @@ async def import_task_from_local_gallery(
958956
remote_info = resp.json()
959957
# Extract uploaded_dir path from response
960958
uploaded_dir = (
961-
remote_info.get("uploaded_files", {})
962-
.get("dir_files", {})
963-
.get("uploaded_dir")
959+
remote_info.get("uploaded_files", {}).get("dir_files", {}).get("uploaded_dir")
964960
)
965961
if uploaded_dir:
966962
try:

0 commit comments

Comments
 (0)