This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增转发copilot接口(支持流式传输,接入one-api) /v1/chat/completions
PandoraNext-tokensTool v 0.5.7版本 1.新增转发copilot接口(支持流式传输,接入one-api) /v1/chat/completions\n 2.新增查看copilot模型接口 /v1/models 3.修改已知bug
- Loading branch information
1 parent
cc9d042
commit 0400a38
Showing
57 changed files
with
551 additions
and
91 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
30 changes: 30 additions & 0 deletions
30
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/ChatCompletionResult.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,30 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ChatCompletionResult { | ||
|
||
private String id; | ||
|
||
private String object; | ||
|
||
private Long created; | ||
|
||
private String model; | ||
|
||
private List<Choice> choices; | ||
|
||
private Usage usage; | ||
|
||
private String system_fingerprint; | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/Choice.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,21 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import com.plexpt.chatgpt.entity.chat.Message; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Choice { | ||
|
||
private long index; | ||
|
||
private Message message; | ||
|
||
private String finish_reason; | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/ContentChoice.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,30 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ContentChoice { | ||
|
||
private String text; | ||
|
||
|
||
private int index; | ||
|
||
|
||
private String logprobs; | ||
|
||
|
||
private String finish_reason; | ||
|
||
|
||
|
||
|
||
} |
67 changes: 67 additions & 0 deletions
67
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/ContentCompletion.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,67 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ContentCompletion { | ||
|
||
/** | ||
* 指定要使用的模型 | ||
*/ | ||
private String model; | ||
|
||
|
||
/** | ||
* 提供一个文本片段,作为模型生成文本的启动点或上下文 | ||
*/ | ||
private String prompt; | ||
|
||
|
||
/** | ||
* 限制生成文本的最大长度,以一定数量的 tokens(标记)为单位。 | ||
*/ | ||
private int max_tokens; | ||
|
||
|
||
/** | ||
* 控制生成文本的创造性,较高的值增加随机性,较低的值使生成更加确定性。 | ||
*/ | ||
private int temperature; | ||
|
||
|
||
/** | ||
* 仅考虑概率累积最高的 tokens,而忽略其他概率较低的 tokens。 | ||
*/ | ||
private int top_p; | ||
|
||
|
||
/** | ||
* 生成多少个不同的文本样本。 | ||
*/ | ||
private int n; | ||
|
||
|
||
/** | ||
* 指定是否启用流式传输,即是否在生成文本时逐步接收输出。 | ||
*/ | ||
private Boolean stream; | ||
|
||
|
||
/** | ||
* 是否返回每个 token 的对数概率。 | ||
*/ | ||
private String logprobs; | ||
|
||
|
||
/** | ||
* 指定在生成文本时的停止条件,即遇到哪个字符串时停止生成。 | ||
*/ | ||
private String stop; | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/ContentResult.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,32 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
|
||
/** | ||
* 内容补全返回结果 | ||
*/ | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ContentResult { | ||
|
||
private String id; | ||
|
||
private String object; | ||
|
||
private Long created; | ||
|
||
private String model; | ||
|
||
private List<ContentChoice> choices; | ||
|
||
private Usage usage; | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/Conversation.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,29 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.plexpt.chatgpt.entity.chat.Message; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Conversation { | ||
|
||
private String model; | ||
|
||
private List<Message> messages; | ||
|
||
private Boolean stream; | ||
|
||
private int temperature; | ||
|
||
@JsonProperty("presence_penalty") | ||
private int presencePenalty; | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/Model.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,22 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Model { | ||
|
||
private String id; | ||
|
||
private String object; | ||
|
||
private Long created; | ||
|
||
private String owned_by; | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/ModelResult.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,20 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ModelResult { | ||
|
||
private String object; | ||
|
||
private List<Model> data; | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
rearServer/src/main/java/com/tokensTool/pandoraNext/chat/Usage.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,36 @@ | ||
package com.tokensTool.pandoraNext.chat; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Usage { | ||
|
||
/** | ||
* 提示词消耗的tokens | ||
*/ | ||
@JsonProperty("prompt_tokens") | ||
private long promptTokens; | ||
|
||
/** | ||
* 回答消耗的tokens | ||
*/ | ||
@JsonProperty("completion_tokens") | ||
private long completionTokens; | ||
|
||
/** | ||
* 本次对话消耗的tokens | ||
*/ | ||
@JsonProperty("total_tokens") | ||
private long totalTokens; | ||
|
||
|
||
|
||
|
||
} |
Oops, something went wrong.