Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)
RegisterRoutes registers all rule routes with swagger documentation
Types ¶
type CreateRuleRequest ¶
CreateRuleRequest represents the request to create a rule
type DeleteRuleResponse ¶
type DeleteRuleResponse struct {
Success bool `json:"success" example:"true"`
Message string `json:"message" example:"Rule deleted successfully"`
}
DeleteRuleResponse represents the response for deleting a rule
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles rule HTTP requests
func NewHandler ¶
NewHandler creates a new rule handler
func (*Handler) CreateRule ¶
CreateRule creates a new rule
func (*Handler) ImportRule ¶
ImportRule imports a rule from base64 encoded data
func (*Handler) UpdateRule ¶
UpdateRule creates or updates a rule
type ImportRuleRequest ¶
type ImportRuleRequest struct {
Data string `json:"data" binding:"required" description:"Base64 encoded rule export data" example:"TGB64:1.0:..."`
// OnProviderConflict specifies what to do when a provider already exists.
// "use" - use existing provider, "skip" - skip this provider, "suffix" - create with suffixed name
OnProviderConflict string `json:"on_provider_conflict" description:"How to handle provider conflicts" example:"use"`
// OnRuleConflict specifies what to do when a rule already exists.
// "skip" - skip import, "update" - update existing rule, "new" - create with new name
OnRuleConflict string `json:"on_rule_conflict" description:"How to handle rule conflicts" example:"new"`
}
ImportRuleRequest represents request to import a rule from base64 encoded data
type ImportRuleResponse ¶
type ImportRuleResponse struct {
Success bool `json:"success" example:"true"`
Message string `json:"message" example:"Rule imported successfully"`
Data struct {
RuleCreated bool `json:"rule_created" example:"true"`
RuleUpdated bool `json:"rule_updated" example:"false"`
ProvidersCreated int `json:"providers_created" example:"1"`
ProvidersUsed int `json:"providers_used" example:"0"`
Providers []ProviderInfo `json:"providers,omitempty"`
} `json:"data"`
}
ImportRuleResponse represents the response for importing a rule
type ProviderInfo ¶
type ProviderInfo struct {
UUID string `json:"uuid" example:"123e4567-e89b-12d3-a456-426614174000"`
Name string `json:"name" example:"openai"`
Action string `json:"action" example:"created"` // "created", "used", "skipped"
}
ProviderInfo contains basic information about an imported or used provider
type RuleResponse ¶
type RuleResponse struct {
Success bool `json:"success" example:"true"`
Data *typ.Rule `json:"data"`
}
RuleResponse represents a rule configuration response
type RulesResponse ¶
type RulesResponse struct {
Success bool `json:"success" example:"true"`
Data interface{} `json:"data"`
}
RulesResponse represents the response for getting all rules
type UpdateRuleRequest ¶
UpdateRuleRequest represents the request to set/update a rule
type UpdateRuleResponse ¶
type UpdateRuleResponse struct {
Success bool `json:"success" example:"true"`
Message string `json:"message" example:"Rule saved successfully"`
Data struct {
UUID string `json:"uuid"`
RequestModel string `json:"request_model" example:"gpt-3.5-turbo"`
ResponseModel string `json:"response_model" example:"gpt-3.5-turbo"`
Description string `json:"description" example:"My rule description"`
Provider string `json:"provider" example:"openai"`
DefaultModel string `json:"default_model" example:"gpt-3.5-turbo"`
Active bool `json:"active" example:"true"`
SmartEnabled bool `json:"smart_enabled" example:"false"`
SmartRouting []smartrouting.SmartRouting `json:"smart_routing,omitempty"`
} `json:"data"`
}
UpdateRuleResponse represents the response for setting/updating a rule