Documentation
¶
Index ¶
- Constants
- func ListProviderTypes() []int
- type AdminChannelCreateInput
- type BatchEditRequest
- type BatchEditResponse
- type ChannelBatchEditor
- type ChannelPatch
- type CreateRequest
- type DataFlowResponse
- type DataFlowStepDTO
- type ExportFilter
- type ExportRequest
- type FetchModelsRequest
- type FetchModelsResponse
- type Handler
- func (h *Handler) BatchEdit(c *app.Context, req BatchEditRequest) (BatchEditResponse, error)
- func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.Channel], error)
- func (h *Handler) DataFlow(c *app.Context, req api.IDPathRequest) (DataFlowResponse, error)
- func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
- func (h *Handler) ExportHTTP(adapter *api.Adapter) gin.HandlerFunc
- func (h *Handler) FetchModels(c *app.Context, req FetchModelsRequest) (FetchModelsResponse, error)
- func (h *Handler) Get(c *app.Context, req api.IDPathRequest) (models.Channel, error)
- func (h *Handler) ImportHTTP(adapter *api.Adapter) gin.HandlerFunc
- func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[models.Channel], error)
- func (h *Handler) Test(c *app.Context, req TestRequest) (TestResponse, error)
- func (h *Handler) Types(_ *app.Context, _ api.EmptyRequest) ([]TypeMeta, error)
- func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.Channel, error)
- type ListRequest
- type TestRequest
- type TestResponse
- type TokenSetter
- type TypeMeta
- type UpdateRequest
Constants ¶
View Source
const ( PriceRatioMin = pricing.PlatformPriceRatioMin PriceRatioMax = pricing.PlatformPriceRatioMax )
PriceRatioMin / PriceRatioMax 是公共 channel 计费倍率的合法区间。 0 合法(settler 归一到原价 1.0);上界 1000 防止误填把成本放大到离谱。
Variables ¶
This section is empty.
Functions ¶
func ListProviderTypes ¶ added in v0.0.2
func ListProviderTypes() []int
ListProviderTypes returns all channel type IDs that represent real, user-selectable providers: every key in newAPIConstant.ChannelTypeNames except the sentinel ChannelTypeUnknown (0) and ChannelTypeDummy (terminal count marker). The result is sorted in ascending order so callers get a stable UI ordering.
Types ¶
type AdminChannelCreateInput ¶ added in v0.0.13
type AdminChannelCreateInput struct {
Name string
PublicDisplayName string
Status int
Type int
Key string
BaseURL string
Models []string
ModelMapping map[string]string
Weight uint
Priority int
UseLegacyAdaptor bool
SupportedAPITypes string
Endpoints string
PassthroughEnabled bool
SystemPrompt string
SystemPromptInInput bool
RoleMapping string
ProxyURL string
ParamOverride string
HeaderOverride string
Tag string
Remark string
Setting string
Organization string
APIVersion string
TestModel string
AutoBan int
StatusCodeMapping string
OtherSettings string
DisableKeepalive bool
Resilience models.ChannelResilience
PriceRatio float64
Free bool
Limit models.ChannelLimit
Affinity models.ChannelAffinity
}
type BatchEditRequest ¶ added in v0.0.15
type BatchEditResponse ¶ added in v0.0.15
type ChannelBatchEditor ¶ added in v0.0.15
type ChannelPatch ¶ added in v0.0.15
type ChannelPatch struct {
// contains filtered or unexported fields
}
func ParseChannelPatch ¶ added in v0.0.15
func ParseChannelPatch(fields map[string]any) (ChannelPatch, error)
func (ChannelPatch) Apply ¶ added in v0.0.15
func (patch ChannelPatch) Apply(channel *models.Channel) error
func (ChannelPatch) Assignments ¶ added in v0.0.15
func (patch ChannelPatch) Assignments() map[string]any
func (ChannelPatch) Empty ¶ added in v0.0.15
func (patch ChannelPatch) Empty() bool
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name" binding:"required"`
PublicDisplayName string `json:"public_display_name"`
Type int `json:"type"`
Key string `json:"key"`
BaseURL string `json:"base_url"`
Models string `json:"models"`
ModelMapping string `json:"model_mapping"`
Weight uint `json:"weight"`
Priority int `json:"priority"`
UseLegacyAdaptor bool `json:"use_legacy_adaptor"`
SupportedAPITypes string `json:"supported_api_types"`
Endpoints string `json:"endpoints"`
PassthroughEnabled bool `json:"passthrough_enabled"`
SystemPrompt string `json:"system_prompt"`
SystemPromptInInput bool `json:"system_prompt_in_input"`
RoleMapping string `json:"role_mapping"`
ProxyURL string `json:"proxy_url"`
ParamOverride string `json:"param_override"`
HeaderOverride string `json:"header_override"`
Tag string `json:"tag"`
Remark string `json:"remark"`
Setting string `json:"setting"`
Organization string `json:"organization"`
ApiVersion string `json:"api_version"`
TestModel string `json:"test_model"`
AutoBan int `json:"auto_ban"`
StatusCodeMapping string `json:"status_code_mapping"`
OtherSettings string `json:"other_settings"`
Resilience *models.ChannelResilience `json:"resilience,omitempty"`
PriceRatio *float64 `json:"price_ratio,omitempty"`
Free *bool `json:"free,omitempty"`
Limit *models.ChannelLimit `json:"limit,omitempty"`
Affinity *models.ChannelAffinity `json:"affinity,omitempty"`
DisableKeepalive bool `json:"disable_keepalive"`
}
type DataFlowResponse ¶ added in v0.0.8
type DataFlowResponse struct {
ChannelID uint `json:"channel_id"`
ResolvedProtocol string `json:"resolved_protocol"`
Steps []DataFlowStepDTO `json:"steps"`
}
type DataFlowStepDTO ¶ added in v0.0.8
type ExportFilter ¶ added in v0.0.13
type ExportRequest ¶ added in v0.0.13
type ExportRequest = channelfile.ExportRequest[ExportFilter]
type FetchModelsRequest ¶
type FetchModelsResponse ¶
type Handler ¶
type Handler struct {
Hub interface {
Call(agentID string, method string, params any, timeout time.Duration) (json.RawMessage, error)
IsOnline(agentID string) bool
}
// MasterListen is the master server's listen address (e.g. ":8140" or
// "0.0.0.0:8140"). Used by the local channel test path to construct a
// loopback URL (http://127.0.0.1:<port>/...) so the test request hits
// master's own relay routes without going through any reverse proxy.
MasterListen string
// AgentStore is the embedded agent's cache store. When set, the local
// channel test path calls SetToken on it to warm the __system_test__
// token (apply-if-present push semantics do not warm new tokens).
// This field is set by the master server after setupEmbeddedAgent completes.
// Unused (nil) when the local path is not used (remote agent tests).
AgentStore app.Store
}
func (*Handler) BatchEdit ¶ added in v0.0.15
func (h *Handler) BatchEdit(c *app.Context, req BatchEditRequest) (BatchEditResponse, error)
func (*Handler) DataFlow ¶ added in v0.0.8
func (h *Handler) DataFlow(c *app.Context, req api.IDPathRequest) (DataFlowResponse, error)
DataFlow 返回某 channel 的请求处理链路自描述(只读,不计费,不落 usage_log)。
func (*Handler) Delete ¶
func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
func (*Handler) ExportHTTP ¶ added in v0.0.13
func (h *Handler) ExportHTTP(adapter *api.Adapter) gin.HandlerFunc
func (*Handler) FetchModels ¶
func (h *Handler) FetchModels(c *app.Context, req FetchModelsRequest) (FetchModelsResponse, error)
func (*Handler) ImportHTTP ¶ added in v0.0.13
func (h *Handler) ImportHTTP(adapter *api.Adapter) gin.HandlerFunc
func (*Handler) List ¶
func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[models.Channel], error)
func (*Handler) Test ¶
func (h *Handler) Test(c *app.Context, req TestRequest) (TestResponse, error)
type ListRequest ¶
type ListRequest struct {
api.PaginationQuery
Search string `form:"search"`
Type string `form:"type"`
Status string `form:"status"`
}
type TestRequest ¶
type TestResponse ¶
type TokenSetter ¶
TokenSetter is the subset of app.Store needed for system-test token warm-up.
type UpdateRequest ¶
type UpdateRequest struct {
ID string `uri:"id" binding:"required"`
Fields map[string]any `json:"-"`
}
func (*UpdateRequest) SetBodyMap ¶
func (r *UpdateRequest) SetBodyMap(fields map[string]any)
Click to show internal directories.
Click to hide internal directories.