From 726fea5b743cae83620a921d27c8b412906498d3 Mon Sep 17 00:00:00 2001 From: Markus Klenke Date: Wed, 4 Dec 2024 22:28:00 +0100 Subject: [PATCH] Fixes #79 --- src/main/java/io/github/ollama4j/OllamaAPI.java | 2 +- .../ollama4j/integrationtests/TestRealAPIs.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/ollama4j/OllamaAPI.java b/src/main/java/io/github/ollama4j/OllamaAPI.java index e504d7e..0c89888 100644 --- a/src/main/java/io/github/ollama4j/OllamaAPI.java +++ b/src/main/java/io/github/ollama4j/OllamaAPI.java @@ -193,7 +193,7 @@ public class OllamaAPI { Elements modelSections = doc.selectXpath("//*[@id='repo']/ul/li/a"); for (Element e : modelSections) { LibraryModel model = new LibraryModel(); - Elements names = e.select("div > h2 > span"); + Elements names = e.select("div > h2 > div > span"); Elements desc = e.select("div > p"); Elements pullCounts = e.select("div:nth-of-type(2) > p > span:first-of-type > span:first-of-type"); Elements popularTags = e.select("div > div > span"); diff --git a/src/test/java/io/github/ollama4j/integrationtests/TestRealAPIs.java b/src/test/java/io/github/ollama4j/integrationtests/TestRealAPIs.java index d584747..0a1da61 100644 --- a/src/test/java/io/github/ollama4j/integrationtests/TestRealAPIs.java +++ b/src/test/java/io/github/ollama4j/integrationtests/TestRealAPIs.java @@ -80,6 +80,18 @@ class TestRealAPIs { } } + @Test + @Order(2) + void testListModelsFromLibrary() { + testEndpointReachability(); + try { + assertNotNull(ollamaAPI.listModelsFromLibrary()); + ollamaAPI.listModelsFromLibrary().forEach(System.out::println); + } catch (IOException | OllamaBaseException | InterruptedException | URISyntaxException e) { + fail(e); + } + } + @Test @Order(2) void testPullModel() {