generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #13 from mloncode/renewed-client-api
New api version for plugin
- Loading branch information
Showing
7 changed files
with
111 additions
and
35 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
21 changes: 20 additions & 1 deletion
21
src/main/kotlin/com/github/bzz/intellij/models/AvailableModels.kt
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,11 +1,30 @@ | ||
package com.github.bzz.intellij.com.github.bzz.intellij.models | ||
|
||
import com.github.bzz.intellij.requests.Requester | ||
import com.intellij.openapi.diagnostic.Logger | ||
import java.util.concurrent.atomic.AtomicInteger | ||
|
||
|
||
object AvailableModels { | ||
|
||
val currentModelIndex = AtomicInteger(0) | ||
|
||
val modelsList: List<String> = listOf("proxy-model", "other proxy-model") | ||
private val logger = Logger.getInstance("(getting available models)") | ||
|
||
private fun getAvailableModels(): List<String> = | ||
try { | ||
Requester.getAvailableModels().models.map { it.modelName } | ||
} catch (knownException: Requester.RequesterException) { | ||
logger.warn(knownException.message) | ||
emptyList() | ||
} catch (otherException: Requester.RequesterException) { | ||
logger.warn("Unknown exception. Message: ${otherException.message}") | ||
emptyList() | ||
} | ||
|
||
val modelsList: List<String> = getAvailableModels() | ||
|
||
fun currentModel() : String? { | ||
return modelsList.getOrNull(currentModelIndex.get()) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/com/github/bzz/intellij/requests/JsonData.kt
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,34 @@ | ||
package com.github.bzz.intellij.com.github.bzz.intellij.requests | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import kotlinx.serialization.Serializable | ||
|
||
|
||
@Serializable | ||
data class ServerProposal ( | ||
val text: String | ||
) | ||
|
||
@Serializable | ||
data class ProposalsResponse ( | ||
val results: List<ServerProposal> | ||
) | ||
|
||
@Serializable | ||
data class LLMModel ( | ||
@SerializedName("model_name") | ||
val modelName: String | ||
) | ||
|
||
@Serializable | ||
data class ModelsResponse( | ||
val models: List<LLMModel> | ||
) | ||
|
||
@Serializable | ||
data class ProposalsQuery( | ||
val model: String, | ||
val prompt: String, | ||
@SerializedName("max_new_tokens") | ||
val maxNewTokens: Int | ||
) |
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: 0 additions & 8 deletions
8
src/main/kotlin/com/github/bzz/intellij/requests/ServerResponse.kt
This file was deleted.
Oops, something went wrong.
File renamed without changes.