rule

package
v0.260313.1200-preview Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

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

type CreateRuleRequest typ.Rule

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

func NewHandler(cfg *config.Config, logger *obs.MemoryLogger) *Handler

NewHandler creates a new rule handler

func (*Handler) CreateRule

func (h *Handler) CreateRule(c *gin.Context)

CreateRule creates a new rule

func (*Handler) DeleteRule

func (h *Handler) DeleteRule(c *gin.Context)

DeleteRule deletes a rule

func (*Handler) GetRule

func (h *Handler) GetRule(c *gin.Context)

GetRule returns a specific rule by UUID

func (*Handler) GetRules

func (h *Handler) GetRules(c *gin.Context)

GetRules returns all rules, filtered by scenario

func (*Handler) UpdateRule

func (h *Handler) UpdateRule(c *gin.Context)

UpdateRule creates or updates a rule

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

type UpdateRuleRequest typ.Rule

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

Jump to

Keyboard shortcuts

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