Skip to content

Commit 3da36ad

Browse files
committed
fix: message history
1 parent 59e9582 commit 3da36ad

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
1919
gpg-passphrase: MAVEN_GPG_PASSPHRASE
2020
- name: Publish package
21-
run: mvn -B -ntp deploy
21+
run: mvn -Ppublish -B -ntp deploy
2222
env:
2323
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2424
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}

pom.xml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.javaaidev</groupId>
88
<artifactId>springai-openai-client</artifactId>
9-
<version>0.5.1</version>
9+
<version>0.5.2</version>
1010

1111
<name>OpenAI ChatModel</name>
1212
<description>Spring AI ChatModel for OpenAI using official Java SDK</description>
@@ -177,26 +177,6 @@
177177
<artifactId>maven-failsafe-plugin</artifactId>
178178
<version>2.22.2</version>
179179
</plugin>
180-
<plugin>
181-
<groupId>org.sonatype.central</groupId>
182-
<artifactId>central-publishing-maven-plugin</artifactId>
183-
</plugin>
184-
<plugin>
185-
<groupId>org.apache.maven.plugins</groupId>
186-
<artifactId>maven-source-plugin</artifactId>
187-
</plugin>
188-
<plugin>
189-
<groupId>org.jetbrains.dokka</groupId>
190-
<artifactId>dokka-maven-plugin</artifactId>
191-
</plugin>
192-
<plugin>
193-
<groupId>org.apache.maven.plugins</groupId>
194-
<artifactId>maven-jar-plugin</artifactId>
195-
</plugin>
196-
<plugin>
197-
<groupId>org.apache.maven.plugins</groupId>
198-
<artifactId>maven-gpg-plugin</artifactId>
199-
</plugin>
200180
</plugins>
201181
</build>
202182

@@ -236,4 +216,33 @@
236216
</dependency>
237217
</dependencies>
238218

219+
<profiles>
220+
<profile>
221+
<id>publish</id>
222+
<build>
223+
<plugins>
224+
<plugin>
225+
<groupId>org.sonatype.central</groupId>
226+
<artifactId>central-publishing-maven-plugin</artifactId>
227+
</plugin>
228+
<plugin>
229+
<groupId>org.apache.maven.plugins</groupId>
230+
<artifactId>maven-source-plugin</artifactId>
231+
</plugin>
232+
<plugin>
233+
<groupId>org.jetbrains.dokka</groupId>
234+
<artifactId>dokka-maven-plugin</artifactId>
235+
</plugin>
236+
<plugin>
237+
<groupId>org.apache.maven.plugins</groupId>
238+
<artifactId>maven-jar-plugin</artifactId>
239+
</plugin>
240+
<plugin>
241+
<groupId>org.apache.maven.plugins</groupId>
242+
<artifactId>maven-gpg-plugin</artifactId>
243+
</plugin>
244+
</plugins>
245+
</build>
246+
</profile>
247+
</profiles>
239248
</project>

src/main/kotlin/com/javaaidev/openai/OpenAIChatModel.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ class OpenAIChatModel(
9191
is SystemMessage -> paramsBuilder.addSystemMessage(message.text)
9292
is AssistantMessage -> {
9393
val messageParamBuilder = ChatCompletionAssistantMessageParam.builder()
94+
val contentParts = mutableListOf(
95+
ChatCompletionAssistantMessageParam.Content.ChatCompletionRequestAssistantMessageContentPart.ofText(
96+
ChatCompletionContentPartText.builder().text(message.text).build()
97+
)
98+
)
9499
message.toolCalls?.map { toolCall ->
95100
ChatCompletionMessageToolCall.builder()
96101
.id(toolCall.id)
@@ -106,6 +111,7 @@ class OpenAIChatModel(
106111
messageParamBuilder.toolCalls(it)
107112
}
108113
}
114+
messageParamBuilder.contentOfArrayOfContentParts(contentParts)
109115
paramsBuilder.addMessage(messageParamBuilder.build())
110116
}
111117

0 commit comments

Comments
 (0)