handlers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserPermissionDenied  = errors.New("user permission denied")
	InvalidSessionId      = errors.New("invalid session id")
	InvalidSessionName    = errors.New("invalid session name")
	InvalidSessionTopic   = errors.New("invalid session topic")
	InvalidSessionSource  = errors.New("invalid session source")
	InvalidSessionModel   = errors.New("invalid session model")
	InvalidSessionResetAt = errors.New("invalid session resetAt")

	ErrAkNotFound        = HTTPError(errors.New("ak not found"), http.StatusUnauthorized)
	ErrAkNotMatch        = HTTPError(errors.New("ak not match"), http.StatusForbidden)
	ErrNoPermission      = HTTPError(errors.New("no permission"), http.StatusForbidden)
	ErrNoAdminPermission = HTTPError(errors.New("no admin permission"), http.StatusForbidden)
)
View Source
var APIs = []*dynamic.API{
	{BackendPath: "/api/ai-proxy/access", Method: http.MethodPost},

	{BackendPath: "/api/ai-proxy/chat-logs", Method: http.MethodGet},
	{BackendPath: "/api/ai-proxy/sessions/{sessionId}/chat-logs", Method: http.MethodGet},

	{BackendPath: "/api/ai-proxy/credentials", Method: http.MethodPost},
	{BackendPath: "/api/ai-proxy/credentials", Method: http.MethodGet},
	{BackendPath: "/api/ai-proxy/credentials/{accessKeyId}", Method: http.MethodDelete},
	{BackendPath: "/api/ai-proxy/credentials/{accessKeyId}", Method: http.MethodPut},
	{BackendPath: "/api/ai-proxy/credentials/{accessKeyId}", Method: http.MethodGet},

	{BackendPath: "/api/ai-proxy/models", Method: http.MethodGet},

	{BackendPath: "/api/ai-proxy/providers", Method: http.MethodPost},
	{BackendPath: "/api/ai-proxy/providers", Method: http.MethodGet},
	{BackendPath: "/api/ai-proxy/providers/{name}/instances/{instanceId}", Method: http.MethodDelete},
	{BackendPath: "/api/ai-proxy/providers/{name}/instances/{instanceId}", Method: http.MethodPut},
	{BackendPath: "/api/ai-proxy/providers/{name}/instances/{instanceId}", Method: http.MethodGet},

	{BackendPath: "/api/ai-proxy/sessions", Method: http.MethodPost},
	{BackendPath: "/api/ai-proxy/sessions", Method: http.MethodGet},
	{BackendPath: "/api/ai-proxy/sessions/{id}", Method: http.MethodDelete},
	{BackendPath: "/api/ai-proxy/sessions/{id}", Method: http.MethodPut},
	{BackendPath: "/api/ai-proxy/sessions/{id}", Method: http.MethodGet},
	{BackendPath: "/api/ai-proxy/sessions/{id}/actions/reset", Method: http.MethodPatch},
	{BackendPath: "/api/ai-proxy/sessions/{id}/actions/archive", Method: http.MethodPatch},

	{BackendPath: "/api/ai-proxy/model-providers", Method: http.MethodPost},
}

Functions

func HTTPError

func HTTPError(err error, code int) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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