mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 18:43:41 +08:00
Refactor codebase, introduce relaymode package, update constants and improve consistency
- Refactor constant definitions and organization - Clean up package level variables and functions - Introduce new `relaymode` and `apitype` packages for constant definitions - Refactor and simplify code in several packages including `openai`, `relay/channel/baidu`, `relay/util`, `relay/controller`, `relay/channeltype` - Add helper functions in `relay/channeltype` package to convert channel type constants to corresponding API type constants - Remove deprecated functions such as `ResponseText2Usage` from `relay/channel/openai/helper.go` - Modify code in `relay/util/validation.go` and related files to use new `validator.ValidateTextRequest` function - Rename `util` package to `relaymode` and update related imports in several packages
This commit is contained in:
50
relay/adaptor/baidu/model.go
Normal file
50
relay/adaptor/baidu/model.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package baidu
|
||||
|
||||
// import (
|
||||
// "github.com/songquanpeng/one-api/relay/channel/openai"
|
||||
// "time"
|
||||
// )
|
||||
|
||||
// type ChatResponse struct {
|
||||
// Id string `json:"id"`
|
||||
// Object string `json:"object"`
|
||||
// Created int64 `json:"created"`
|
||||
// Result string `json:"result"`
|
||||
// IsTruncated bool `json:"is_truncated"`
|
||||
// NeedClearHistory bool `json:"need_clear_history"`
|
||||
// Usage openai.Usage `json:"usage"`
|
||||
// Error
|
||||
// }
|
||||
|
||||
// type ChatStreamResponse struct {
|
||||
// ChatResponse
|
||||
// SentenceId int `json:"sentence_id"`
|
||||
// IsEnd bool `json:"is_end"`
|
||||
// }
|
||||
|
||||
// type EmbeddingRequest struct {
|
||||
// Input []string `json:"input"`
|
||||
// }
|
||||
|
||||
// type EmbeddingData struct {
|
||||
// Object string `json:"object"`
|
||||
// Embedding []float64 `json:"embedding"`
|
||||
// Index int `json:"index"`
|
||||
// }
|
||||
|
||||
// type EmbeddingResponse struct {
|
||||
// Id string `json:"id"`
|
||||
// Object string `json:"object"`
|
||||
// Created int64 `json:"created"`
|
||||
// Data []EmbeddingData `json:"data"`
|
||||
// Usage openai.Usage `json:"usage"`
|
||||
// Error
|
||||
// }
|
||||
|
||||
// type AccessToken struct {
|
||||
// AccessToken string `json:"access_token"`
|
||||
// Error string `json:"error,omitempty"`
|
||||
// ErrorDescription string `json:"error_description,omitempty"`
|
||||
// ExpiresIn int64 `json:"expires_in,omitempty"`
|
||||
// ExpiresAt time.Time `json:"-"`
|
||||
// }
|
||||
Reference in New Issue
Block a user