Skip to content

Commit 8b46b70

Browse files
committed
chore(deps): Bump com.aallam.openai:openai-client from 3.2.5 to 3.4.1
1 parent 17c9be6 commit 8b46b70

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ tasks.withType<KotlinCompile>().configureEach {
9898
}
9999

100100
dependencies {
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
}

src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/OpenAIService.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.github.blarc.ai.commits.intellij.plugin
22

3-
import com.aallam.openai.api.BetaOpenAI
43
import com.aallam.openai.api.chat.*
54
import com.aallam.openai.api.model.ModelId
65
import 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+
}

0 commit comments

Comments
 (0)