one-api/providers/xunfei/type.go
2024-01-03 16:37:27 +08:00

75 lines
2.2 KiB
Go

package xunfei
import "one-api/types"
type XunfeiMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
type XunfeiChatPayloadMessage struct {
Text []XunfeiMessage `json:"text"`
}
type XunfeiChatPayloadFunctions struct {
Text []*types.ChatCompletionFunction `json:"text"`
}
type XunfeiChatPayload struct {
Message XunfeiChatPayloadMessage `json:"message"`
Functions *XunfeiChatPayloadFunctions `json:"functions,omitempty"`
}
type XunfeiParameterChat struct {
Domain string `json:"domain,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopK int `json:"top_k,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Auditing bool `json:"auditing,omitempty"`
}
type XunfeiChatRequestParameter struct {
Chat XunfeiParameterChat `json:"chat"`
}
type XunfeiChatRequest struct {
Header struct {
AppId string `json:"app_id"`
} `json:"header"`
Parameter XunfeiChatRequestParameter `json:"parameter"`
Payload XunfeiChatPayload `json:"payload"`
}
type XunfeiChatResponseTextItem struct {
Content string `json:"content"`
Role string `json:"role"`
Index int `json:"index"`
ContentType string `json:"content_type,omitempty"`
FunctionCall *types.ChatCompletionToolCallsFunction `json:"function_call,omitempty"`
}
type XunfeiChatResponse struct {
Header struct {
Code int `json:"code"`
Message string `json:"message"`
Sid string `json:"sid"`
Status int `json:"status"`
} `json:"header"`
Payload struct {
Choices struct {
Status int `json:"status"`
Seq int `json:"seq"`
Text []XunfeiChatResponseTextItem `json:"text"`
} `json:"choices"`
Usage struct {
//Text struct {
// QuestionTokens string `json:"question_tokens"`
// PromptTokens string `json:"prompt_tokens"`
// CompletionTokens string `json:"completion_tokens"`
// TotalTokens string `json:"total_tokens"`
//} `json:"text"`
Text types.Usage `json:"text"`
} `json:"usage"`
} `json:"payload"`
}