You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
package com.plexworlds.l3.config
|
|
|
|
import com.plexworlds.l3.llm.provider.Ollama
|
|
import com.intellij.openapi.application.ApplicationManager
|
|
import com.intellij.openapi.components.PersistentStateComponent
|
|
import com.intellij.openapi.components.Storage
|
|
import com.intellij.openapi.components.State
|
|
import com.intellij.util.xmlb.XmlSerializerUtil
|
|
import com.plexworlds.l3.llm.model.DummyModel
|
|
import com.plexworlds.l3.llm.model.Model
|
|
import com.plexworlds.l3.llm.provider.DummyProvider
|
|
import com.plexworlds.l3.llm.provider.Provider
|
|
|
|
/**
|
|
* Presumably used to store the state of the L3 plugin between sessions.
|
|
*/
|
|
@State(
|
|
name = "com.plexworlds.l3.config.L3PersistentState",
|
|
storages = [Storage("local-llama-link-plugin.xml")]
|
|
)
|
|
class L3PersistentState : PersistentStateComponent<L3PersistentState> {
|
|
|
|
@JvmField
|
|
var model: Model = DummyModel
|
|
|
|
@JvmField
|
|
var modelOverride: String = ""
|
|
|
|
@JvmField
|
|
var url: String = ""
|
|
|
|
@JvmField
|
|
var provider: Provider = DummyProvider
|
|
|
|
override fun getState(): L3PersistentState = this
|
|
|
|
override fun loadState(l3PersistentState: L3PersistentState) {
|
|
XmlSerializerUtil.copyBean(l3PersistentState, this)
|
|
|
|
|
|
|
|
}
|
|
|
|
companion object {
|
|
fun getInstance(): L3PersistentState {
|
|
return ApplicationManager.getApplication().getService(L3PersistentState::class.java)
|
|
}
|
|
}
|
|
}
|