api

package
v0.9.43 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func FormatStreamError added in v0.9.15

func FormatStreamError(_ context.Context, err error) any

FormatStreamError formats a stream error into an OpenAI-compatible JSON error object.

func JSONError added in v0.6.3

func JSONError(c *gin.Context, status int, err error)

JSONError returns a JSON error response and adds the error to gin context for access logging.

func WriteGeminiStream added in v0.5.3

func WriteGeminiStream(c *gin.Context, stream streams.Stream[*httpclient.StreamEvent])

func WriteJSONStream added in v0.5.3

func WriteJSONStream(c *gin.Context, stream streams.Stream[*httpclient.StreamEvent])

WriteJSONStream writes stream events as plain JSON text stream.

func WriteSSEStream added in v0.5.3

func WriteSSEStream(c *gin.Context, stream streams.Stream[*httpclient.StreamEvent])

WriteSSEStream writes stream events as Server-Sent Events (SSE) with default error formatting.

func WriteSSEStreamWithErrorFormatter added in v0.9.15

func WriteSSEStreamWithErrorFormatter(c *gin.Context, stream streams.Stream[*httpclient.StreamEvent], formatErr StreamErrorFormatter)

WriteSSEStreamWithErrorFormatter writes stream events as SSE with a custom error formatter.

Types

type APIKeyHandlers added in v0.8.5

type APIKeyHandlers struct {
	APIKeyService *biz.APIKeyService
}

func NewAPIKeyHandlers added in v0.8.5

func NewAPIKeyHandlers(params APIKeyHandlersParams) *APIKeyHandlers

type APIKeyHandlersParams added in v0.8.5

type APIKeyHandlersParams struct {
	fx.In

	APIKeyService *biz.APIKeyService
}

type AiSDKHandlers

type AiSDKHandlers struct {
	ChatCompletionHandler *ChatCompletionHandlers
}

func NewAiSDKHandlers

func NewAiSDKHandlers(params AiSdkHandlersParams) *AiSDKHandlers

func (*AiSDKHandlers) ChatCompletion

func (handlers *AiSDKHandlers) ChatCompletion(c *gin.Context)

type AiSdkHandlersParams

type AiSdkHandlersParams struct {
	fx.In

	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
}

type AnthropicHandlers

type AnthropicHandlers struct {
	ChannelService         *biz.ChannelService
	ModelService           *biz.ModelService
	SystemService          *biz.SystemService
	ChatCompletionHandlers *ChatCompletionHandlers
}

func NewAnthropicHandlers

func NewAnthropicHandlers(params AnthropicHandlersParams) *AnthropicHandlers

func (*AnthropicHandlers) CreateMessage

func (handlers *AnthropicHandlers) CreateMessage(c *gin.Context)

func (*AnthropicHandlers) ListModels added in v0.3.0

func (handlers *AnthropicHandlers) ListModels(c *gin.Context)

ListModels returns all available models. It uses QueryAllChannelModels setting from system config to determine model source.

type AnthropicHandlersParams

type AnthropicHandlersParams struct {
	fx.In

	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
}

type AnthropicModel added in v0.3.0

type AnthropicModel struct {
	ID          string    `json:"id"`
	Type        string    `json:"type"`
	DisplayName string    `json:"display_name"`
	CreatedAt   time.Time `json:"created"`
}

type AntigravityHandlers added in v0.9.0

type AntigravityHandlers struct {
	// contains filtered or unexported fields
}

func NewAntigravityHandlers added in v0.9.0

func NewAntigravityHandlers(params AntigravityHandlersParams) *AntigravityHandlers

func (*AntigravityHandlers) Exchange added in v0.9.0

func (h *AntigravityHandlers) Exchange(c *gin.Context)

Exchange exchanges callback URL for OAuth credentials. POST /admin/antigravity/oauth/exchange.

func (*AntigravityHandlers) StartOAuth added in v0.9.0

func (h *AntigravityHandlers) StartOAuth(c *gin.Context)

StartOAuth creates a PKCE session and returns the authorize URL. POST /admin/antigravity/oauth/start.

type AntigravityHandlersParams added in v0.9.0

type AntigravityHandlersParams struct {
	fx.In

	CacheConfig xcache.Config
	HttpClient  *httpclient.HttpClient
}

type AuthHandlers

type AuthHandlers struct {
	AuthService *biz.AuthService
}

func NewAuthHandlers

func NewAuthHandlers(params AuthHandlersParams) *AuthHandlers

func (*AuthHandlers) SignIn

func (h *AuthHandlers) SignIn(c *gin.Context)

SignIn handles user authentication.

type AuthHandlersParams

type AuthHandlersParams struct {
	fx.In

	AuthService *biz.AuthService
}

type Capabilities added in v0.9.3

type Capabilities struct {
	Vision    bool `json:"vision"`
	ToolCall  bool `json:"tool_call"`
	Reasoning bool `json:"reasoning"`
}

type ChatCompletionHandlers added in v0.5.3

type ChatCompletionHandlers struct {
	ChatCompletionOrchestrator *orchestrator.ChatCompletionOrchestrator
	StreamWriter               StreamWriter
}

func NewChatCompletionHandlers

func NewChatCompletionHandlers(orchestrator *orchestrator.ChatCompletionOrchestrator) *ChatCompletionHandlers

func (*ChatCompletionHandlers) ChatCompletion added in v0.5.3

func (handlers *ChatCompletionHandlers) ChatCompletion(c *gin.Context)

func (*ChatCompletionHandlers) WithStreamWriter added in v0.5.3

func (handlers *ChatCompletionHandlers) WithStreamWriter(writer StreamWriter) *ChatCompletionHandlers

WithStreamWriter returns a new ChatCompletionHandlers with the specified stream writer.

type ClaudeCodeHandlers added in v0.8.7

type ClaudeCodeHandlers struct {
	// contains filtered or unexported fields
}

func NewClaudeCodeHandlers added in v0.8.7

func NewClaudeCodeHandlers(params ClaudeCodeHandlersParams) *ClaudeCodeHandlers

func (*ClaudeCodeHandlers) Exchange added in v0.8.7

func (h *ClaudeCodeHandlers) Exchange(c *gin.Context)

Exchange exchanges callback URL for OAuth credentials JSON. POST /admin/claudecode/oauth/exchange.

func (*ClaudeCodeHandlers) StartOAuth added in v0.8.7

func (h *ClaudeCodeHandlers) StartOAuth(c *gin.Context)

StartOAuth creates a PKCE session and returns the authorize URL. POST /admin/claudecode/oauth/start.

type ClaudeCodeHandlersParams added in v0.8.7

type ClaudeCodeHandlersParams struct {
	fx.In

	CacheConfig xcache.Config
	HttpClient  *httpclient.HttpClient
}

type Clock added in v0.9.10

type Clock interface {
	Now() time.Time
	After(d time.Duration) <-chan time.Time
}

Clock provides time-related functions for testability.

type CodexHandlers added in v0.8.3

type CodexHandlers struct {
	// contains filtered or unexported fields
}

func NewCodexHandlers added in v0.8.3

func NewCodexHandlers(params CodexHandlersParams) *CodexHandlers

func (*CodexHandlers) DecodeAuthJSON added in v0.9.37

func (h *CodexHandlers) DecodeAuthJSON(c *gin.Context)

DecodeAuthJSON decodes Codex auth.json into normalized OAuth credentials JSON. POST /admin/codex/auth/decode.

func (*CodexHandlers) Exchange added in v0.8.3

func (h *CodexHandlers) Exchange(c *gin.Context)

Exchange exchanges callback URL for OAuth credentials JSON. POST /admin/codex/oauth/exchange.

func (*CodexHandlers) StartOAuth added in v0.8.3

func (h *CodexHandlers) StartOAuth(c *gin.Context)

StartOAuth creates a PKCE session and returns the authorize URL. POST /admin/codex/oauth/start.

type CodexHandlersParams added in v0.8.3

type CodexHandlersParams struct {
	fx.In

	CacheConfig xcache.Config
	HttpClient  *httpclient.HttpClient
}

type CopilotHandlers added in v0.9.10

type CopilotHandlers struct {
	// contains filtered or unexported fields
}

CopilotHandlers provides HTTP handlers for GitHub Copilot OAuth device flow.

func NewCopilotHandlers added in v0.9.10

func NewCopilotHandlers(params CopilotHandlersParams) *CopilotHandlers

func (*CopilotHandlers) PollOAuth added in v0.9.10

func (h *CopilotHandlers) PollOAuth(c *gin.Context)

PollOAuth polls for the OAuth access token using the device flow. POST /admin/copilot/oauth/poll

func (*CopilotHandlers) StartOAuth added in v0.9.10

func (h *CopilotHandlers) StartOAuth(c *gin.Context)

StartOAuth initiates the GitHub OAuth device flow. POST /admin/copilot/oauth/start

type CopilotHandlersParams added in v0.9.10

type CopilotHandlersParams struct {
	fx.In

	CacheConfig xcache.Config
	HttpClient  *httpclient.HttpClient
	Clock       Clock `optional:"true"`
}

CopilotHandlersParams contains the dependencies for CopilotHandlers.

type DecodeCodexAuthJSONRequest added in v0.9.37

type DecodeCodexAuthJSONRequest struct {
	AuthJSON string `json:"auth_json" binding:"required"`
}

type DecodeCodexAuthJSONResponse added in v0.9.37

type DecodeCodexAuthJSONResponse struct {
	Credentials string `json:"credentials"`
}

type DoubaoHandlers added in v0.9.9

type DoubaoHandlers struct {
	VideoService       *biz.VideoService
	CreateOrchestrator *orchestrator.ChatCompletionOrchestrator
	InboundTransformer *doubao.VideoInboundTransformer
}

func NewDoubaoHandlers added in v0.9.9

func NewDoubaoHandlers(params DoubaoHandlersParams) *DoubaoHandlers

func (*DoubaoHandlers) CreateTask added in v0.9.9

func (h *DoubaoHandlers) CreateTask(c *gin.Context)

func (*DoubaoHandlers) DeleteTask added in v0.9.9

func (h *DoubaoHandlers) DeleteTask(c *gin.Context)

func (*DoubaoHandlers) GetTask added in v0.9.9

func (h *DoubaoHandlers) GetTask(c *gin.Context)

type DoubaoHandlersParams added in v0.9.9

type DoubaoHandlersParams struct {
	fx.In

	VideoService                *biz.VideoService
	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
}

type DownloadContentRequest added in v0.9.9

type DownloadContentRequest struct {
	RequestID int `uri:"request_id"`
}

type ExchangeAntigravityOAuthRequest added in v0.9.0

type ExchangeAntigravityOAuthRequest struct {
	SessionID   string                  `json:"session_id" binding:"required"`
	CallbackURL string                  `json:"callback_url" binding:"required"`
	Proxy       *httpclient.ProxyConfig `json:"proxy,omitempty"`
}

type ExchangeAntigravityOAuthResponse added in v0.9.0

type ExchangeAntigravityOAuthResponse struct {
	Credentials string `json:"credentials"`
}

type ExchangeClaudeCodeOAuthRequest added in v0.8.7

type ExchangeClaudeCodeOAuthRequest struct {
	SessionID   string                  `json:"session_id" binding:"required"`
	CallbackURL string                  `json:"callback_url" binding:"required"`
	Proxy       *httpclient.ProxyConfig `json:"proxy,omitempty"`
}

type ExchangeClaudeCodeOAuthResponse added in v0.8.7

type ExchangeClaudeCodeOAuthResponse struct {
	Credentials string `json:"credentials"`
}

type ExchangeCodexOAuthRequest added in v0.8.3

type ExchangeCodexOAuthRequest struct {
	SessionID   string                  `json:"session_id" binding:"required"`
	CallbackURL string                  `json:"callback_url" binding:"required"`
	Proxy       *httpclient.ProxyConfig `json:"proxy,omitempty"`
}

type ExchangeCodexOAuthResponse added in v0.8.3

type ExchangeCodexOAuthResponse struct {
	Credentials string `json:"credentials"`
}

type GeminiHandlers added in v0.5.3

type GeminiHandlers struct {
	ChannelService         *biz.ChannelService
	ModelService           *biz.ModelService
	ChatCompletionHandlers *ChatCompletionHandlers
}

func NewGeminiHandlers added in v0.5.3

func NewGeminiHandlers(params GeminiHandlersParams) *GeminiHandlers

func (*GeminiHandlers) GenerateContent added in v0.5.3

func (handlers *GeminiHandlers) GenerateContent(c *gin.Context)

func (*GeminiHandlers) ListModels added in v0.7.0

func (handlers *GeminiHandlers) ListModels(c *gin.Context)

ListModels returns all available Gemini models. This endpoint is compatible with Gemini's /v1/models API. It uses QueryAllChannelModels setting from system config to determine model source.

type GeminiHandlersParams added in v0.5.3

type GeminiHandlersParams struct {
	fx.In

	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
}

type GeminiModel added in v0.7.0

type GeminiModel struct {
	Name                       string   `json:"name"`
	BaseModelID                string   `json:"baseModelId"`
	Version                    string   `json:"version"`
	DisplayName                string   `json:"displayName"`
	Description                string   `json:"description"`
	SupportedGenerationMethods []string `json:"supportedGenerationMethods"`
}

GeminiModel represents a model in the list models response.

type HealthResponse

type HealthResponse struct {
	Status    string     `json:"status"`
	Timestamp time.Time  `json:"timestamp"`
	Version   string     `json:"version"`
	Build     build.Info `json:"build"`
	Uptime    string     `json:"uptime"`
}

HealthResponse 健康检查响应.

type InitializeSystemRequest

type InitializeSystemRequest struct {
	OwnerEmail     string `json:"ownerEmail"     binding:"required,email"`
	OwnerPassword  string `json:"ownerPassword"  binding:"required,min=6"`
	OwnerFirstName string `json:"ownerFirstName" binding:"required"`
	OwnerLastName  string `json:"ownerLastName"  binding:"required"`
	BrandName      string `json:"brandName"      binding:"required"`
	PreferLanguage string `json:"preferLanguage,omitempty"`
}

InitializeSystemRequest 系统初始化请求.

type InitializeSystemResponse

type InitializeSystemResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

InitializeSystemResponse 系统初始化响应.

type JinaHandlers added in v0.7.0

type JinaHandlers struct {
	RerankHandlers    *ChatCompletionHandlers
	EmbeddingHandlers *ChatCompletionHandlers
}

func NewJinaHandlers added in v0.7.0

func NewJinaHandlers(params JinaHandlersParams) *JinaHandlers

func (*JinaHandlers) CreateEmbedding added in v0.7.0

func (h *JinaHandlers) CreateEmbedding(c *gin.Context)

func (*JinaHandlers) Rerank added in v0.7.0

func (h *JinaHandlers) Rerank(c *gin.Context)

Rerank handles rerank requests.

type JinaHandlersParams added in v0.7.0

type JinaHandlersParams struct {
	fx.In

	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
}

type OpenAIHandlers

type OpenAIHandlers struct {
	ChannelService             *biz.ChannelService
	ModelService               *biz.ModelService
	SystemService              *biz.SystemService
	VideoService               *biz.VideoService
	ChatCompletionHandlers     *ChatCompletionHandlers
	ResponseCompletionHandlers *ChatCompletionHandlers
	CompactHandlers            *ChatCompletionHandlers
	EmbeddingHandlers          *ChatCompletionHandlers
	ImageGenerationHandlers    *ChatCompletionHandlers
	ImageEditHandlers          *ChatCompletionHandlers
	ImageVariationHandlers     *ChatCompletionHandlers
	VideoHandlers              *ChatCompletionHandlers
	VideoInboundTransformer    *openai.VideoInboundTransformer
	EntClient                  *ent.Client
}

func NewOpenAIHandlers

func NewOpenAIHandlers(params OpenAIHandlersParams) *OpenAIHandlers

func (*OpenAIHandlers) ChatCompletion

func (handlers *OpenAIHandlers) ChatCompletion(c *gin.Context)

func (*OpenAIHandlers) CompactResponse added in v0.9.23

func (handlers *OpenAIHandlers) CompactResponse(c *gin.Context)

func (*OpenAIHandlers) CreateEmbedding added in v0.6.5

func (handlers *OpenAIHandlers) CreateEmbedding(c *gin.Context)

func (*OpenAIHandlers) CreateImage added in v0.9.0

func (handlers *OpenAIHandlers) CreateImage(c *gin.Context)

func (*OpenAIHandlers) CreateImageEdit added in v0.9.0

func (handlers *OpenAIHandlers) CreateImageEdit(c *gin.Context)

func (*OpenAIHandlers) CreateImageVariation added in v0.9.0

func (handlers *OpenAIHandlers) CreateImageVariation(c *gin.Context)

func (*OpenAIHandlers) CreateResponse added in v0.6.0

func (handlers *OpenAIHandlers) CreateResponse(c *gin.Context)

func (*OpenAIHandlers) CreateVideo added in v0.9.9

func (handlers *OpenAIHandlers) CreateVideo(c *gin.Context)

func (*OpenAIHandlers) DeleteVideo added in v0.9.9

func (handlers *OpenAIHandlers) DeleteVideo(c *gin.Context)

func (*OpenAIHandlers) GetVideo added in v0.9.9

func (handlers *OpenAIHandlers) GetVideo(c *gin.Context)

func (*OpenAIHandlers) ListModels added in v0.3.0

func (handlers *OpenAIHandlers) ListModels(c *gin.Context)

ListModels returns all available models. This endpoint is compatible with OpenAI's /v1/models API. It uses QueryAllChannelModels setting from system config to determine model source.

func (*OpenAIHandlers) RetrieveModel added in v0.9.26

func (handlers *OpenAIHandlers) RetrieveModel(c *gin.Context)

RetrieveModel returns a single available model. This endpoint is compatible with OpenAI's /v1/models/{model} API.

type OpenAIHandlersParams

type OpenAIHandlersParams struct {
	fx.In

	VideoService                *biz.VideoService
	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
	Client                      *ent.Client
}

type OpenAIModel added in v0.3.0

type OpenAIModel struct {
	ID              string        `json:"id"`
	Object          string        `json:"object"`
	Created         int64         `json:"created"`
	OwnedBy         string        `json:"owned_by"`
	Name            string        `json:"name,omitempty"`
	Description     string        `json:"description,omitempty"`
	ContextLength   int           `json:"context_length,omitempty"`
	MaxOutputTokens int           `json:"max_output_tokens,omitempty"`
	Capabilities    *Capabilities `json:"capabilities,omitempty"`
	Pricing         *Pricing      `json:"pricing,omitempty"`
	Icon            string        `json:"icon,omitempty"`
	Type            string        `json:"type,omitempty"`
}

type PlaygroundHandlers

type PlaygroundHandlers struct {
	ChannelService             *biz.ChannelService
	ChatCompletionOrchestrator *orchestrator.ChatCompletionOrchestrator
}

func NewPlaygroundHandlers

func NewPlaygroundHandlers(params PlaygroundHandlersParams) *PlaygroundHandlers

func (*PlaygroundHandlers) ChatCompletion

func (handlers *PlaygroundHandlers) ChatCompletion(c *gin.Context)

func (*PlaygroundHandlers) HandleError added in v0.1.1

func (handlers *PlaygroundHandlers) HandleError(rawErr error) *PlaygroundResponseError

HandleError handles raw errors and returns a PlaygroundResponseError.

type PlaygroundHandlersParams

type PlaygroundHandlersParams struct {
	fx.In

	ChannelService              *biz.ChannelService
	ModelService                *biz.ModelService
	DefaultSelector             *orchestrator.DefaultSelector
	RequestService              *biz.RequestService
	SystemService               *biz.SystemService
	UsageLogService             *biz.UsageLogService
	PromptService               *biz.PromptService
	PromptProtectionRuleService *biz.PromptProtectionRuleService
	QuotaService                *biz.QuotaService
	HttpClient                  *httpclient.HttpClient
	LiveStreamRegistry          *biz.LiveStreamRegistry
}

type PlaygroundResponseError

type PlaygroundResponseError struct {
	Status int `json:"-"`
	Error  struct {
		Code    int    `json:"code,omitempty"`
		Message string `json:"message"`
	} `json:"error"`
}

type PollCopilotOAuthRequest added in v0.9.10

type PollCopilotOAuthRequest struct {
	SessionID string                  `json:"session_id" binding:"required"`
	Proxy     *httpclient.ProxyConfig `json:"proxy,omitempty"`
}

PollCopilotOAuthRequest represents the request body for polling OAuth token.

type PollCopilotOAuthResponse added in v0.9.10

type PollCopilotOAuthResponse struct {
	Token   string `json:"access_token,omitempty"` //nolint:gosec
	Type    string `json:"token_type,omitempty"`
	Scope   string `json:"scope,omitempty"`
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

PollCopilotOAuthResponse represents the response for polling OAuth token.

type Pricing added in v0.9.3

type Pricing struct {
	Input      float64 `json:"input"`
	Output     float64 `json:"output"`
	CacheRead  float64 `json:"cache_read"`
	CacheWrite float64 `json:"cache_write"`
	Unit       string  `json:"unit"`
	Currency   string  `json:"currency"`
}

type RequestContentHandlers added in v0.9.9

type RequestContentHandlers struct {
	DataStorageService *biz.DataStorageService
}

func NewRequestContentHandlers added in v0.9.9

func NewRequestContentHandlers(params RequestContentHandlersParams) *RequestContentHandlers

func (*RequestContentHandlers) DownloadRequestContent added in v0.9.9

func (h *RequestContentHandlers) DownloadRequestContent(c *gin.Context)

type RequestContentHandlersParams added in v0.9.9

type RequestContentHandlersParams struct {
	fx.In

	DataStorageService *biz.DataStorageService
}

type RequestDetailPreviewContract added in v0.9.33

type RequestDetailPreviewContract struct {
	SingleInstanceOnly                           bool
	SupportsDistributedReplay                    bool
	AllowsDatabaseSchemaChanges                  bool
	ExecutionLevelPreview                        bool
	EventOrder                                   []string
	Scope                                        string
	ReuseInMemoryChunkBuffer                     bool
	FinalBatchPersistenceUnchanged               bool
	FallbackMode                                 string
	FallbackBehavior                             string
	FallbackUsesExecutionPreview                 bool
	FallbackStartsSecondaryLivePollingLoop       bool
	EndpointPath                                 string
	ContentType                                  string
	EventTypes                                   []string
	ReplayOmitsTerminalDoneEvent                 bool
	IncrementalOmitsTerminalDoneEvent            bool
	ConnectAfterCompletionFallsBackToStaticFetch bool
}

func RequestDetailSSEContract added in v0.9.33

func RequestDetailSSEContract() RequestDetailPreviewContract

type RequestPreviewFallbackResponse added in v0.9.33

type RequestPreviewFallbackResponse struct {
	Mode           string                   `json:"mode"`
	ResponseChunks []objects.JSONRawMessage `json:"responseChunks"`
}

type RequestPreviewHandlers added in v0.9.33

type RequestPreviewHandlers struct {
	RequestService     *biz.RequestService
	LiveStreamRegistry *biz.LiveStreamRegistry
	StreamWriter       StreamWriter
}

func NewRequestPreviewHandlers added in v0.9.33

func NewRequestPreviewHandlers(params RequestPreviewHandlersParams) *RequestPreviewHandlers

func (*RequestPreviewHandlers) PreviewRequest added in v0.9.33

func (h *RequestPreviewHandlers) PreviewRequest(c *gin.Context)

type RequestPreviewHandlersParams added in v0.9.33

type RequestPreviewHandlersParams struct {
	fx.In

	RequestService     *biz.RequestService
	LiveStreamRegistry *biz.LiveStreamRegistry
}

type SignInRequest

type SignInRequest struct {
	Email    string `json:"email"    binding:"required,email"`
	Password string `json:"password" binding:"required"`
}

SignInRequest 登录请求.

type SignInResponse

type SignInResponse struct {
	User  *objects.UserInfo `json:"user"`
	Token string            `json:"token"`
}

SignInResponse 登录响应.

type StartAntigravityOAuthRequest added in v0.9.0

type StartAntigravityOAuthRequest struct {
	ProjectID string `json:"project_id"`
}

type StartAntigravityOAuthResponse added in v0.9.0

type StartAntigravityOAuthResponse struct {
	SessionID string `json:"session_id"`
	AuthURL   string `json:"auth_url"`
}

type StartClaudeCodeOAuthRequest added in v0.8.7

type StartClaudeCodeOAuthRequest struct{}

type StartClaudeCodeOAuthResponse added in v0.8.7

type StartClaudeCodeOAuthResponse struct {
	SessionID string `json:"session_id"`
	AuthURL   string `json:"auth_url"`
}

type StartCodexOAuthRequest added in v0.8.3

type StartCodexOAuthRequest struct{}

type StartCodexOAuthResponse added in v0.8.3

type StartCodexOAuthResponse struct {
	SessionID string `json:"session_id"`
	AuthURL   string `json:"auth_url"`
}

type StartCopilotOAuthRequest added in v0.9.10

type StartCopilotOAuthRequest struct {
	Proxy *httpclient.ProxyConfig `json:"proxy,omitempty"`
}

StartCopilotOAuthRequest represents the request body for starting OAuth device flow.

type StartCopilotOAuthResponse added in v0.9.10

type StartCopilotOAuthResponse struct {
	SessionID       string `json:"session_id"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
}

StartCopilotOAuthResponse represents the response for starting OAuth device flow.

type StreamErrorFormatter added in v0.9.15

type StreamErrorFormatter func(ctx context.Context, err error) any

StreamErrorFormatter formats a stream error into a JSON-serializable object for SSE error events.

type StreamWriter added in v0.5.3

type StreamWriter func(c *gin.Context, stream streams.Stream[*httpclient.StreamEvent])

StreamWriter is a function type for writing stream events to the response.

type SystemHandlers

type SystemHandlers struct {
	SystemService *biz.SystemService
}

func NewSystemHandlers

func NewSystemHandlers(params SystemHandlersParams) *SystemHandlers

func (*SystemHandlers) GetFavicon

func (h *SystemHandlers) GetFavicon(c *gin.Context)

GetFavicon returns the system brand logo as favicon.

func (*SystemHandlers) GetSystemStatus

func (h *SystemHandlers) GetSystemStatus(c *gin.Context)

GetSystemStatus returns the system initialization status.

func (*SystemHandlers) Health

func (h *SystemHandlers) Health(c *gin.Context)

Health returns the application health status and build information.

func (*SystemHandlers) InitializeSystem

func (h *SystemHandlers) InitializeSystem(c *gin.Context)

InitializeSystem initializes the system with owner credentials.

func (*SystemHandlers) WebhookEcho added in v0.9.32

func (h *SystemHandlers) WebhookEcho(c *gin.Context)

WebhookEcho echos inbound webhook requests for validation.

type SystemHandlersParams

type SystemHandlersParams struct {
	fx.In

	SystemService *biz.SystemService
}

type SystemStatusResponse

type SystemStatusResponse struct {
	IsInitialized bool `json:"isInitialized"`
}

SystemStatusResponse 系统状态响应.

type WebhookDebugResponse added in v0.9.32

type WebhookDebugResponse struct {
	Method  string              `json:"method"`
	Path    string              `json:"path"`
	Query   map[string][]string `json:"query"`
	Headers map[string][]string `json:"headers"`
	Body    json.RawMessage     `json:"body"`
}

Jump to

Keyboard shortcuts

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