controller

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 40 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddChannel

func AddChannel(c *gin.Context)

func AddGroup added in v1.0.1

func AddGroup(c *gin.Context)

func AddToken

func AddToken(c *gin.Context)

func AutomaticallyTestChannels

func AutomaticallyTestChannels(frequency int)

func AutomaticallyUpdateChannels

func AutomaticallyUpdateChannels(frequency int)

func CreateMetadata

func CreateMetadata(g *gin.Context)

func CreateUser

func CreateUser(c *gin.Context)

func DashboardListModels

func DashboardListModels(c *gin.Context)

func DeleteChannel

func DeleteChannel(c *gin.Context)

func DeleteDisabledChannel

func DeleteDisabledChannel(c *gin.Context)

func DeleteGroup added in v1.0.1

func DeleteGroup(c *gin.Context)

func DeleteMetadata

func DeleteMetadata(g *gin.Context)

func DeleteToken

func DeleteToken(c *gin.Context)

func DeleteUser

func DeleteUser(c *gin.Context)

func FetchChannelModels added in v1.0.1

func FetchChannelModels(c *gin.Context)

FetchChannelModels 从上游拉取模型列表。 编辑渠道时传 channel_id(后端从 DB 取 key);新增渠道时传 key。 base_url 优先用请求值,空则回退到 channeltype.ChannelBaseURLs。 先尝试 {base_url}/v1/models,若返回非 2xx 则回退到 {base_url}/models。

func GenerateAccessToken

func GenerateAccessToken(c *gin.Context)

func GetAllActiveLogs added in v1.0.1

func GetAllActiveLogs(c *gin.Context)

GetAllActiveLogs 获取当前所有活跃(在转发中)的请求

func GetAllChannels

func GetAllChannels(c *gin.Context)

func GetAllLogs

func GetAllLogs(c *gin.Context)

func GetAllMetadata

func GetAllMetadata(g *gin.Context)

func GetAllTokens

func GetAllTokens(c *gin.Context)

func GetAllUsers

func GetAllUsers(c *gin.Context)

func GetAuthHeader

func GetAuthHeader(token string) http.Header

GetAuthHeader get auth header

func GetChannel

func GetChannel(c *gin.Context)

func GetChannelDescriptors added in v1.0.1

func GetChannelDescriptors(c *gin.Context)

GetChannelDescriptors 下发渠道能力清单(PRD §5.12 层1 / 决策 D7)。

前端启动 / 进入渠道页时拉取,据此渲染渠道类型下拉、列表标签与通用面板, 从而不在前端硬编码任何渠道类型(描述符驱动 + 通用渲染器)。

本仓不注册任何渠道 → 注册表为空 → 返回空列表;扩展渠道的清单由扩展方在其 init() 中注入。data 恒为数组(空时为 []),便于前端统一处理。

func GetGroup added in v1.0.1

func GetGroup(c *gin.Context)

func GetGroupList added in v1.0.1

func GetGroupList(c *gin.Context)

func GetGroups

func GetGroups(c *gin.Context)

func GetLogDetail

func GetLogDetail(c *gin.Context)

func GetLogsSelfStat

func GetLogsSelfStat(c *gin.Context)

func GetLogsStat

func GetLogsStat(c *gin.Context)

func GetMetadata

func GetMetadata(g *gin.Context)

func GetOptions

func GetOptions(c *gin.Context)

func GetResponseBody

func GetResponseBody(method, url string, channel *model.Channel, headers http.Header) ([]byte, error)

func GetSelf

func GetSelf(c *gin.Context)

func GetStatus

func GetStatus(c *gin.Context)

func GetSubscription

func GetSubscription(c *gin.Context)

func GetToken

func GetToken(c *gin.Context)

func GetTokenStatus

func GetTokenStatus(c *gin.Context)

func GetUsage

func GetUsage(c *gin.Context)

func GetUser

func GetUser(c *gin.Context)

func GetUserAvailableModels

func GetUserAvailableModels(c *gin.Context)

func GetUserDashboard

func GetUserDashboard(c *gin.Context)

func GetUserLogs

func GetUserLogs(c *gin.Context)

func HandleSSEOptions added in v1.0.1

func HandleSSEOptions(c *gin.Context)

HandleSSEOptions 处理 SSE 连接前的 OPTIONS preflight(CORS,不要求认证)

func ListAllModels

func ListAllModels(c *gin.Context)

func ListModels

func ListModels(c *gin.Context)

func Login

func Login(c *gin.Context)

func Logout

func Logout(c *gin.Context)

func ManageUser

func ManageUser(c *gin.Context)

ManageUser Only admin user can do this

func Relay

func Relay(c *gin.Context)

func RelayNotFound

func RelayNotFound(c *gin.Context)

func RelayNotImplemented

func RelayNotImplemented(c *gin.Context)

func ResetChannel

func ResetChannel(c *gin.Context)

func RetrieveModel

func RetrieveModel(c *gin.Context)

func SearchAllLogs

func SearchAllLogs(c *gin.Context)

func SearchChannels

func SearchChannels(c *gin.Context)

func SearchTokens

func SearchTokens(c *gin.Context)

func SearchUserLogs

func SearchUserLogs(c *gin.Context)

func SearchUsers

func SearchUsers(c *gin.Context)

func SetupLogin

func SetupLogin(user *model.User, c *gin.Context)

setup session & cookies and then return user info

func StreamActiveLogs added in v1.0.1

func StreamActiveLogs(c *gin.Context)

StreamActiveLogs SSE 端点,实时推送活跃请求的增删改事件

func TestChannel

func TestChannel(c *gin.Context)

func TestChannels

func TestChannels(c *gin.Context)

func UpdateAllChannelsBalance

func UpdateAllChannelsBalance(c *gin.Context)

func UpdateChannel

func UpdateChannel(c *gin.Context)

func UpdateChannelBalance

func UpdateChannelBalance(c *gin.Context)

func UpdateGroup added in v1.0.1

func UpdateGroup(c *gin.Context)

func UpdateMetadata

func UpdateMetadata(g *gin.Context)

func UpdateOption

func UpdateOption(c *gin.Context)

func UpdateSelf

func UpdateSelf(c *gin.Context)

func UpdateToken

func UpdateToken(c *gin.Context)

func UpdateUser

func UpdateUser(c *gin.Context)

Types

type AIProxyUserOverviewResponse

type AIProxyUserOverviewResponse struct {
	Success   bool   `json:"success"`
	Message   string `json:"message"`
	ErrorCode int    `json:"error_code"`
	Data      struct {
		TotalPoints float64 `json:"totalPoints"`
	} `json:"data"`
}

type APGC2DGPTUsageResponse

type APGC2DGPTUsageResponse struct {
	//Grants         interface{} `json:"grants"`
	Object         string  `json:"object"`
	TotalAvailable float64 `json:"total_available"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
}

type API2GPTUsageResponse

type API2GPTUsageResponse struct {
	Object         string  `json:"object"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
	TotalRemaining float64 `json:"total_remaining"`
}

type DeepSeekUsageResponse

type DeepSeekUsageResponse struct {
	IsAvailable  bool `json:"is_available"`
	BalanceInfos []struct {
		Currency        string `json:"currency"`
		TotalBalance    string `json:"total_balance"`
		GrantedBalance  string `json:"granted_balance"`
		ToppedUpBalance string `json:"topped_up_balance"`
	} `json:"balance_infos"`
}

type FetchModelsRequest added in v1.0.1

type FetchModelsRequest struct {
	BaseURL     string `json:"base_url"`
	Key         string `json:"key"`
	ChannelID   int    `json:"channel_id"`
	ChannelType int    `json:"channel_type"`
}

type GroupRequest added in v1.0.1

type GroupRequest struct {
	Name       string   `json:"name"`
	ModelRatio *float64 `json:"model_ratio"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type ManageRequest

type ManageRequest struct {
	Username string `json:"username"`
	Action   string `json:"action"`
}

type OpenAICreditGrants

type OpenAICreditGrants struct {
	Object         string  `json:"object"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
	TotalAvailable float64 `json:"total_available"`
}

type OpenAIModelPermission

type OpenAIModelPermission struct {
	Id                 string  `json:"id"`
	Object             string  `json:"object"`
	Created            int     `json:"created"`
	AllowCreateEngine  bool    `json:"allow_create_engine"`
	AllowSampling      bool    `json:"allow_sampling"`
	AllowLogprobs      bool    `json:"allow_logprobs"`
	AllowSearchIndices bool    `json:"allow_search_indices"`
	AllowView          bool    `json:"allow_view"`
	AllowFineTuning    bool    `json:"allow_fine_tuning"`
	Organization       string  `json:"organization"`
	Group              *string `json:"group"`
	IsBlocking         bool    `json:"is_blocking"`
}

type OpenAIModels

type OpenAIModels struct {
	Id                       string                  `json:"id"`
	Object                   string                  `json:"object"`
	Created                  int                     `json:"created"`
	OwnedBy                  string                  `json:"owned_by"`
	Permission               []OpenAIModelPermission `json:"permission"`
	Root                     string                  `json:"root"`
	Parent                   *string                 `json:"parent"`
	SupportedEndpointTypes   []apitype.EndpointType  `json:"supported_endpoint_types,omitempty"`
	DisplayName              string                  `json:"display_name,omitempty"`
	Visibility               string                  `json:"visibility,omitempty"`
	SupportedInApi           bool                    `json:"supported_in_api,omitempty"`
	Priority                 int                     `json:"priority,omitempty"`
	DefaultReasoningLevel    string                  `json:"default_reasoning_level,omitempty"`
	SupportedReasoningLevels []string                `json:"supported_reasoning_levels,omitempty"`
	ContextWindow            int                     `json:"context_window,omitempty"`
	TruncationPolicy         string                  `json:"truncation_policy,omitempty"`
	InputModalities          []string                `json:"input_modalities,omitempty"`
	ApplyPatchToolType       string                  `json:"apply_patch_tool_type,omitempty"`
	WebSearchToolType        string                  `json:"web_search_tool_type,omitempty"`
}

type OpenAISBUsageResponse

type OpenAISBUsageResponse struct {
	Msg  string `json:"msg"`
	Data *struct {
		Credit string `json:"credit"`
	} `json:"data"`
}

type OpenAISubscriptionResponse

type OpenAISubscriptionResponse struct {
	Object             string  `json:"object"`
	HasPaymentMethod   bool    `json:"has_payment_method"`
	SoftLimitUSD       float64 `json:"soft_limit_usd"`
	HardLimitUSD       float64 `json:"hard_limit_usd"`
	SystemHardLimitUSD float64 `json:"system_hard_limit_usd"`
	AccessUntil        int64   `json:"access_until"`
}

type OpenAIUsageDailyCost

type OpenAIUsageDailyCost struct {
	Timestamp float64 `json:"timestamp"`
	LineItems []struct {
		Name string  `json:"name"`
		Cost float64 `json:"cost"`
	}
}

type OpenAIUsageResponse

type OpenAIUsageResponse struct {
	Object string `json:"object"`
	//DailyCosts []OpenAIUsageDailyCost `json:"daily_costs"`
	TotalUsage float64 `json:"total_usage"` // unit: 0.01 dollar
}

type OpenRouterResponse

type OpenRouterResponse struct {
	Data struct {
		TotalCredits float64 `json:"total_credits"`
		TotalUsage   float64 `json:"total_usage"`
	} `json:"data"`
}

type SiliconFlowUsageResponse

type SiliconFlowUsageResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Status  bool   `json:"status"`
	Data    struct {
		ID            string `json:"id"`
		Name          string `json:"name"`
		Image         string `json:"image"`
		Email         string `json:"email"`
		IsAdmin       bool   `json:"isAdmin"`
		Balance       string `json:"balance"`
		Status        string `json:"status"`
		Introduction  string `json:"introduction"`
		Role          string `json:"role"`
		ChargeBalance string `json:"chargeBalance"`
		TotalBalance  string `json:"totalBalance"`
		Category      string `json:"category"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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