Merge remote-tracking branch 'origin/upstream/main'

This commit is contained in:
Laisky.Cai
2024-02-19 07:23:30 +00:00
71 changed files with 2003 additions and 2097 deletions

View File

@@ -1,61 +1,61 @@
package xunfei
import (
"github.com/songquanpeng/one-api/relay/channel/openai"
)
// import (
// "github.com/songquanpeng/one-api/relay/model"
// )
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
}
// type Message struct {
// Role string `json:"role"`
// Content string `json:"content"`
// }
type ChatRequest struct {
Header struct {
AppId string `json:"app_id"`
} `json:"header"`
Parameter struct {
Chat 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"`
} `json:"chat"`
} `json:"parameter"`
Payload struct {
Message struct {
Text []Message `json:"text"`
} `json:"message"`
} `json:"payload"`
}
// type ChatRequest struct {
// Header struct {
// AppId string `json:"app_id"`
// } `json:"header"`
// Parameter struct {
// Chat 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"`
// } `json:"chat"`
// } `json:"parameter"`
// Payload struct {
// Message struct {
// Text []Message `json:"text"`
// } `json:"message"`
// } `json:"payload"`
// }
type ChatResponseTextItem struct {
Content string `json:"content"`
Role string `json:"role"`
Index int `json:"index"`
}
// type ChatResponseTextItem struct {
// Content string `json:"content"`
// Role string `json:"role"`
// Index int `json:"index"`
// }
type ChatResponse 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 []ChatResponseTextItem `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 openai.Usage `json:"text"`
} `json:"usage"`
} `json:"payload"`
}
// type ChatResponse 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 []ChatResponseTextItem `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 model.Usage `json:"text"`
// } `json:"usage"`
// } `json:"payload"`
// }