Documentation
¶
Index ¶
- Variables
- func Handler(c *gin.Context, resp *http.Response, _ int, modelName string) (*model.ErrorWithStatusCode, *string)
- func ResponseCoze2OpenAI(cozeResponse *Response) *openai.TextResponse
- func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *string)
- type Adaptor
- func (a *Adaptor) ConvertRequest(meta *meta.Meta, req *http.Request) (string, http.Header, io.Reader, error)
- func (a *Adaptor) DoRequest(_ *meta.Meta, _ *gin.Context, req *http.Request) (*http.Response, error)
- func (a *Adaptor) DoResponse(meta *meta.Meta, c *gin.Context, resp *http.Response) (usage *relaymodel.Usage, err *relaymodel.ErrorWithStatusCode)
- func (a *Adaptor) GetBaseURL() string
- func (a *Adaptor) GetChannelName() string
- func (a *Adaptor) GetModelList() []*model.ModelConfig
- func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error)
- func (a *Adaptor) KeyHelp() string
- func (a *Adaptor) SetupRequestHeader(meta *meta.Meta, _ *gin.Context, req *http.Request) error
- func (a *Adaptor) ValidateKey(key string) error
- type ErrorInformation
- type Message
- type Request
- type Response
- type StreamResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ModelList = []*model.ModelConfig{}
Functions ¶
func ResponseCoze2OpenAI ¶
func ResponseCoze2OpenAI(cozeResponse *Response) *openai.TextResponse
func StreamHandler ¶
Types ¶
type Adaptor ¶
type Adaptor struct{}
func (*Adaptor) ConvertRequest ¶
func (*Adaptor) DoResponse ¶
func (a *Adaptor) DoResponse(meta *meta.Meta, c *gin.Context, resp *http.Response) (usage *relaymodel.Usage, err *relaymodel.ErrorWithStatusCode)
func (*Adaptor) GetBaseURL ¶
func (*Adaptor) GetChannelName ¶
func (*Adaptor) GetModelList ¶
func (a *Adaptor) GetModelList() []*model.ModelConfig
func (*Adaptor) SetupRequestHeader ¶
func (*Adaptor) ValidateKey ¶
type ErrorInformation ¶
type Response ¶
type Response struct { ConversationID string `json:"conversation_id,omitempty"` Msg string `json:"msg,omitempty"` Messages []Message `json:"messages,omitempty"` Code int `json:"code,omitempty"` }
func StreamResponseCoze2OpenAI ¶
func StreamResponseCoze2OpenAI(cozeResponse *StreamResponse) (*openai.ChatCompletionsStreamResponse, *Response)
type StreamResponse ¶
type StreamResponse struct { Message *Message `json:"message,omitempty"` ErrorInformation *ErrorInformation `json:"error_information,omitempty"` Event string `json:"event,omitempty"` ConversationID string `json:"conversation_id,omitempty"` Index int `json:"index,omitempty"` IsFinish bool `json:"is_finish,omitempty"` }
Click to show internal directories.
Click to hide internal directories.