Skip to content

Commit

Permalink
fix to handle new api result
Browse files Browse the repository at this point in the history
  • Loading branch information
liej6799 committed Feb 22, 2023
1 parent 587bfc2 commit 2c866c0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@
<version>2.9.0</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>

<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>2.9.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.github.plexpt.chatgpt.api.conversation;

import lombok.Data;

@Data
public class Author {
public String role;
public Object name;
public Metadata metadata;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@Data
public class Message {
public String id;
public Author author;
public String role;
public Object user;
public Object create_time;
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/github/chatgpt/OpenAIAuthTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public void getConversation() {
ArrayList<String> parts = new ArrayList<>();
ArrayList<Message> messages = new ArrayList<>();

parts.add("Hi There");
parts.add("Generate a poem about yourself");

Content content = Content.builder()
.content_type("text")
.parts(parts).build();

Message message = Message.builder()
.id("71d419a8-ab0a-4f76-b17c-13edeea8c087")
.id(java.util.UUID.randomUUID().toString())
.role("user")
.content(content)
.build();
Expand All @@ -71,7 +71,7 @@ public void getConversation() {
.action("next")
.messages(messages)
.conversation_id(null)
.parent_message_id("55b6f907-1c3c-4111-9b15-df8ff71ab1ca")
.parent_message_id(java.util.UUID.randomUUID().toString())
.model("text-davinci-002-render-sha")
.build();

Expand Down

0 comments on commit 2c866c0

Please sign in to comment.