File tree 2 files changed +2
-18
lines changed
src/main/java/io/github/jetkai/openai/api
2 files changed +2
-18
lines changed Original file line number Diff line number Diff line change 1
1
distributionBase =GRADLE_USER_HOME
2
2
distributionPath =wrapper/dists
3
- distributionUrl =https\://services.gradle.org/distributions/gradle-8.0.1 -bin.zip
3
+ distributionUrl =https\://services.gradle.org/distributions/gradle-8.0.2 -bin.zip
4
4
networkTimeout =10000
5
5
zipStoreBase =GRADLE_USER_HOME
6
6
zipStorePath =wrapper/dists
Original file line number Diff line number Diff line change 1
1
package io .github .jetkai .openai .api ;
2
2
3
- import com .fasterxml .jackson .databind .ObjectMapper ;
4
3
import io .github .jetkai .openai .api .data .completion .chat .ChatCompletionData ;
5
4
import io .github .jetkai .openai .api .data .completion .chat .message .ChatCompletionMessageData ;
6
5
import io .github .jetkai .openai .api .data .completion .choice .CompletionChoiceData ;
@@ -49,7 +48,7 @@ public ChatCompletionMessageData asChatResponseData() {
49
48
*/
50
49
public List <ChatCompletionMessageData > asChatResponseDataList () {
51
50
if (this .deserializedData == null ) {
52
- this .deserializedData = deserialize ();
51
+ this .deserializedData = deserialize (CompletionResponseData . class );
53
52
}
54
53
if (!(this .deserializedData instanceof CompletionResponseData )) {
55
54
return null ;
@@ -76,19 +75,4 @@ public List<ChatCompletionMessageData> asChatResponseDataList() {
76
75
return chatDataList ;
77
76
}
78
77
79
- private synchronized CompletionResponseData deserialize () {
80
- CompletionResponseData data = null ;
81
- String json = this .getRawJsonResponse ();
82
- try {
83
- if (json .contains ("\" error\" :" )) {
84
- throw new Exception (json );
85
- }
86
- ObjectMapper mapper = new ObjectMapper ();
87
- data = mapper .readValue (json , CompletionResponseData .class );
88
- } catch (Exception e ) {
89
- e .printStackTrace ();
90
- }
91
- return data ;
92
- }
93
-
94
78
}
You can’t perform that action at this time.
0 commit comments