-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增 ChatMessageAccumulatorWrapper,以便于能够在使用chatCompletion时使用原始 chunk 数据…
…。这一需求主要适用于chat API的转发场景。
- Loading branch information
1 parent
05f4673
commit 323d430
Showing
10 changed files
with
109 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
service/src/main/java/com/theokanning/openai/service/ChatMessageAccumulatorWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.theokanning.openai.service; | ||
|
||
import com.theokanning.openai.completion.chat.ChatCompletionChunk; | ||
|
||
/** | ||
* Wrapper class of ChatMessageAccumulator | ||
* | ||
* @author Allen Hu | ||
* @date 2024/10/18 | ||
*/ | ||
public class ChatMessageAccumulatorWrapper { | ||
|
||
private final ChatMessageAccumulator chatMessageAccumulator; | ||
private final ChatCompletionChunk chatCompletionChunk; | ||
|
||
public ChatMessageAccumulatorWrapper(ChatMessageAccumulator chatMessageAccumulator, ChatCompletionChunk chatCompletionChunk) { | ||
this.chatMessageAccumulator = chatMessageAccumulator; | ||
this.chatCompletionChunk = chatCompletionChunk; | ||
} | ||
|
||
public ChatMessageAccumulator getChatMessageAccumulator() { | ||
return chatMessageAccumulator; | ||
} | ||
|
||
public ChatCompletionChunk getChatCompletionChunk() { | ||
return chatCompletionChunk; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters