File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ tasks.withType<KotlinCompile>().configureEach {
9898}
9999
100100dependencies {
101- implementation(" com.aallam.openai:openai-client:3.2.5 " ) {
101+ implementation(" com.aallam.openai:openai-client:3.4.1 " ) {
102102 exclude(group = " org.slf4j" , module = " slf4j-api" )
103103 // Prevents java.lang.LinkageError: java.lang.LinkageError: loader constraint violation:when resolving method 'long kotlin.time.Duration.toLong-impl(long, kotlin.time.DurationUnit)'
104104 exclude(group = " org.jetbrains.kotlin" , module = " kotlin-stdlib" )
@@ -114,6 +114,6 @@ dependencies {
114114 exclude(group = " org.jetbrains.kotlin" , module = " kotlin-stdlib-jdk7" )
115115 exclude(group = " org.jetbrains.kotlin" , module = " kotlin-stdlib-jdk8" )
116116 }
117-
117+
118118 implementation(" com.knuddels:jtokkit:0.6.1" )
119119}
Original file line number Diff line number Diff line change 11package com.github.blarc.ai.commits.intellij.plugin
22
3- import com.aallam.openai.api.BetaOpenAI
43import com.aallam.openai.api.chat.*
54import com.aallam.openai.api.model.ModelId
65import com.aallam.openai.client.OpenAI
@@ -20,7 +19,6 @@ class OpenAIService {
2019 get() = ApplicationManager .getApplication().getService(OpenAIService ::class .java)
2120 }
2221
23- @OptIn(BetaOpenAI ::class )
2422 suspend fun generateCommitMessage (prompt : String , completions : Int ): String {
2523 val openAI = OpenAI (AppSettings .instance.getOpenAIConfig())
2624
@@ -41,7 +39,7 @@ class OpenAIService {
4139 )
4240
4341 val completion: ChatCompletion = openAI.chatCompletion(chatCompletionRequest)
44- return completion.choices[0 ].message!! .content
42+ return completion.choices[0 ].message.content ? : " API returned an empty response. "
4543 }
4644
4745 suspend fun refreshOpenAIModelIds () {
@@ -60,4 +58,4 @@ class OpenAIService {
6058 val openAI = OpenAI (config)
6159 openAI.models()
6260 }
63- }
61+ }
You can’t perform that action at this time.
0 commit comments