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) ConvertImageRequest(request *model.ImageRequest) (any, error)
- func (a *Adaptor) ConvertRequest(_ *gin.Context, _ int, request *model.GeneralOpenAIRequest) (any, error)
- func (a *Adaptor) ConvertSTTRequest(*http.Request) (io.ReadCloser, error)
- func (a *Adaptor) ConvertTTSRequest(*model.TextToSpeechRequest) (any, error)
- func (a *Adaptor) DoRequest(c *gin.Context, meta *meta.Meta, requestBody io.Reader) (*http.Response, error)
- func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode)
- func (a *Adaptor) GetChannelName() string
- func (a *Adaptor) GetModelList() []string
- func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error)
- func (a *Adaptor) Init(meta *meta.Meta)
- func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error
- type ErrorInformation
- type Message
- type Request
- type Response
- type StreamResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ModelList = []string{}
Functions ¶
func ResponseCoze2OpenAI ¶
func ResponseCoze2OpenAI(cozeResponse *Response) *openai.TextResponse
func StreamHandler ¶
Types ¶
type Adaptor ¶
type Adaptor struct {
// contains filtered or unexported fields
}
func (*Adaptor) ConvertImageRequest ¶
func (a *Adaptor) ConvertImageRequest(request *model.ImageRequest) (any, error)
func (*Adaptor) ConvertRequest ¶
func (*Adaptor) ConvertSTTRequest ¶
func (*Adaptor) ConvertTTSRequest ¶
func (a *Adaptor) ConvertTTSRequest(*model.TextToSpeechRequest) (any, error)
func (*Adaptor) DoResponse ¶
func (*Adaptor) GetChannelName ¶
func (*Adaptor) GetModelList ¶
type ErrorInformation ¶
type Request ¶
type Request struct { ConversationID string `json:"conversation_id,omitempty"` BotID string `json:"bot_id"` User string `json:"user"` Query string `json:"query"` ChatHistory []Message `json:"chat_history,omitempty"` Stream bool `json:"stream"` }
func ConvertRequest ¶
func ConvertRequest(textRequest *model.GeneralOpenAIRequest) *Request
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.