-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from devoxx/issue-244
Fix #244 Load Jan models and list them for usage
- Loading branch information
Showing
14 changed files
with
129 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/com/devoxx/genie/service/exception/ModelNotActiveException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.devoxx.genie.service.exception; | ||
|
||
public class ModelNotActiveException extends RuntimeException { | ||
|
||
public ModelNotActiveException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#Mon Sep 09 09:17:52 CEST 2024 | ||
version=0.2.18 | ||
#Mon Sep 09 15:46:08 CEST 2024 | ||
version=0.2.19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
src/test/java/com/devoxx/genie/model/GeminiClientTest.java
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
src/test/java/com/devoxx/genie/service/jan/JanServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.devoxx.genie.service.jan; | ||
|
||
import com.devoxx.genie.chatmodel.AbstractLightPlatformTestCase; | ||
import com.devoxx.genie.model.jan.Data; | ||
import com.devoxx.genie.ui.settings.DevoxxGenieStateService; | ||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.testFramework.ServiceContainerUtil; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public class JanServiceTest extends AbstractLightPlatformTestCase { | ||
|
||
@BeforeEach | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
// Mock SettingsState | ||
DevoxxGenieStateService settingsStateMock = mock(DevoxxGenieStateService.class); | ||
when(settingsStateMock.getJanModelUrl()).thenReturn("http://localhost:1337/v1/"); | ||
|
||
// Replace the service instance with the mock | ||
ServiceContainerUtil.replaceService(ApplicationManager.getApplication(), DevoxxGenieStateService.class, settingsStateMock, getTestRootDisposable()); | ||
} | ||
|
||
@Test | ||
public void testGetModels() throws IOException { | ||
JanService janService = new JanService(); | ||
List<Data> models = janService.getModels(); | ||
assertThat(models).isNotEmpty(); | ||
|
||
models.forEach(model -> { | ||
assertThat(model).isNotNull(); | ||
assertThat(model.getId()).isNotNull(); | ||
assertThat(model.getName()).isNotNull(); | ||
assertThat(model.getDescription()).isNotNull(); | ||
assertThat(model.getSettings()).isNotNull(); | ||
assertThat(model.getSettings().getCtxLen()).isNotNull(); | ||
}); | ||
} | ||
} | ||
|