api

package
v0.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Body       string
}

APIError 表示上游返回的非 2xx 响应

func (*APIError) Error

func (e *APIError) Error() string

type Backend

type Backend interface {
	HandlerType() utils.HandlerType
	APIType() []utils.APIType
	ReplaceModel(body []byte, model string) []byte
	Chat(req *Request) (*http.Response, error)
}

Backend 后端适配器统一接口

type BackendOpts added in v0.7.0

type BackendOpts interface {
	HandlerType() utils.HandlerType
}

BackendOpts 后端专有选项的统一接口,各后端定义自己的 Options 类型实现此接口

type Request added in v0.7.0

type Request struct {
	Ctx     context.Context
	CredID  string
	Body    []byte
	Headers http.Header
	APIType utils.APIType
	Opts    BackendOpts // 后端专有选项,如 *gemini.Options
}

Request 携带转发请求的公共上下文,由 bridge 层构建后传递给 Backend.Chat

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL