mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: WIP openai rewrite
This commit is contained in:
parent
30f9c82d73
commit
a77a0e430f
5 changed files with 101 additions and 54 deletions
|
|
@ -79,7 +79,8 @@ export interface ChatMessage {
|
|||
|
||||
// only relevant for ChatGPTUnofficialProxyAPI (optional for ChatGPTAPI)
|
||||
conversationId?: string
|
||||
functionCall?: openai.FunctionCall
|
||||
functionCall?: openai.FunctionCall,
|
||||
toolCalls?: openai.ToolCall[],
|
||||
}
|
||||
|
||||
export class ChatGPTError extends Error {
|
||||
|
|
@ -203,7 +204,8 @@ export namespace openai {
|
|||
delta: {
|
||||
role: Role
|
||||
content?: string,
|
||||
function_call?: {name: string, arguments: string}
|
||||
function_call?: FunctionCall,
|
||||
tool_calls: ToolCall[]
|
||||
}
|
||||
index: number
|
||||
finish_reason: string | null
|
||||
|
|
@ -236,7 +238,9 @@ export namespace openai {
|
|||
*/
|
||||
name?: string
|
||||
function_call?: FunctionCall
|
||||
|
||||
tool_calls?: ToolCall,
|
||||
// required todo
|
||||
// tool_choice?: 'none' | 'auto' | 'required'
|
||||
}
|
||||
|
||||
export interface FunctionCall {
|
||||
|
|
@ -244,6 +248,17 @@ export namespace openai {
|
|||
arguments: string
|
||||
}
|
||||
|
||||
export interface ToolCall {
|
||||
id: string
|
||||
type: "function"
|
||||
function: FunctionCall
|
||||
}
|
||||
|
||||
export interface Tools {
|
||||
type: "function" | string,
|
||||
function: Function
|
||||
}
|
||||
|
||||
export declare const ChatCompletionRequestMessageRoleEnum: {
|
||||
readonly System: 'system'
|
||||
readonly User: 'user'
|
||||
|
|
@ -271,7 +286,8 @@ export namespace openai {
|
|||
*/
|
||||
content: string
|
||||
|
||||
function_call: FunctionCall
|
||||
function_call: FunctionCall,
|
||||
tool_calls: ToolCall[]
|
||||
}
|
||||
export declare const ChatCompletionResponseMessageRoleEnum: {
|
||||
readonly System: 'system'
|
||||
|
|
@ -360,6 +376,8 @@ export namespace openai {
|
|||
user?: string
|
||||
|
||||
functions?: Function[]
|
||||
|
||||
tools?: Tools[]
|
||||
}
|
||||
export interface Function {
|
||||
name: string
|
||||
|
|
@ -470,4 +488,4 @@ export namespace openai {
|
|||
*/
|
||||
total_tokens: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue