Skip to content

Commit

Permalink
fix: fix story id
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 17, 2023
1 parent 3891d5d commit e19e279
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Expand Up @@ -32,10 +32,11 @@ class DtRunConfiguration(project: Project, name: String, factory: ConfigurationF
super.writeExternal(element)

element.writeString("githubToken", options.githubToken())
element.writeString("githubRepo", options.githubRepo())
element.writeString("openAiApiKey", options.openAiApiKey())
element.writeString("aiEngineVersion", options.aiEngineVersion().toString())
element.writeString("aiMaxTokens", options.aiMaxTokens().toString())
element.writeString("githubRepo", options.githubRepo())
element.writeString("storyId", options.storyId())
}

override fun readExternal(element: Element) {
Expand All @@ -46,6 +47,7 @@ class DtRunConfiguration(project: Project, name: String, factory: ConfigurationF
element.readString("aiEngineVersion")?.let { this.options.setAiEngineVersion(it.toInt()) }
element.readString("aiMaxTokens")?.let { this.options.setAiMaxTokens(it.toInt()) }
element.readString("githubRepo")?.let { this.options.setGithubRepo(it) }
element.readString("storyId")?.let { this.options.setStoryId(it) }
}

fun setGithubToken(text: String) {
Expand Down
Expand Up @@ -18,7 +18,7 @@ class DtSettingsEditor(project: Project) : SettingsEditor<DtRunConfiguration>()

private var panel: JComponent? = null

private val githubInput = DtCommandLineEditor(project, completionProvider)
private val githubToken = DtCommandLineEditor(project, completionProvider)
private val aiApiToken = DtCommandLineEditor(project, completionProvider)
private val githubRepo = DtCommandLineEditor(project, completionProvider)
private val storyId = DtCommandLineEditor(project, completionProvider)
Expand All @@ -34,7 +34,7 @@ class DtSettingsEditor(project: Project) : SettingsEditor<DtRunConfiguration>()

override fun createEditor(): JComponent = panel {
row("Github Token:") {
fullWidthCell(githubInput)
fullWidthCell(githubToken)
}

row ("GitHub Project (owner/repo)") {
Expand Down Expand Up @@ -66,7 +66,8 @@ class DtSettingsEditor(project: Project) : SettingsEditor<DtRunConfiguration>()
}

override fun resetEditorFrom(configuration: DtRunConfiguration) {
githubInput.text = configuration.options.githubToken()
githubToken.text = configuration.options.githubToken()
githubRepo.text = configuration.options.githubRepo()
aiApiToken.text = configuration.options.openAiApiKey()
aiEngineVersion.selectedIndex = configuration.options.aiEngineVersion()
openAiMaxTokens = configuration.options.aiMaxTokens()
Expand All @@ -75,11 +76,11 @@ class DtSettingsEditor(project: Project) : SettingsEditor<DtRunConfiguration>()
}

override fun applyEditorTo(configuration: DtRunConfiguration) {
configuration.setGithubToken(githubInput.text)
configuration.setGithubToken(githubToken.text)
configuration.setGithubRepo(githubRepo.text)
configuration.setOpenAiApiKey(aiApiToken.text)
configuration.setAiVersion(DtOpenAIVersion.fromIndex(aiEngineVersion.selectedIndex))
configuration.setAiMaxTokens(openAiMaxTokens)
configuration.setGithubRepo(githubRepo.text)
configuration.setStoryId(storyId.text)
}
}
Expand Down

0 comments on commit e19e279

Please sign in to comment.