v1

package
v0.0.0-...-c20d9b3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c *web.Context, msg string) error

Types

type V1Handler

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

func NewV1Handler

func NewV1Handler(
	logger *slog.Logger,
	w *web.Web,
	proxy *proxy.LLMProxy,
	proxyUse domain.ProxyUsecase,
	usecase domain.OpenAIUsecase,
	euse domain.ExtensionUsecase,
	uuse domain.UserUsecase,
	middleware *middleware.ProxyMiddleware,
	active *middleware.ActiveMiddleware,
	config *config.Config,
) *V1Handler

func (*V1Handler) AcceptCompletion

func (h *V1Handler) AcceptCompletion(c *web.Context, req domain.AcceptCompletionReq) error

AcceptCompletion 接受补全请求

@Tags			OpenAIV1
@Summary		接受补全请求
@Description	接受补全请求
@ID				accept-completion
@Accept			json
@Produce		json
@Param			param	body		domain.AcceptCompletionReq	true	"补全请求"
@Success		200		{object}	web.Resp{}
@Router			/v1/completion/accept [post]

func (*V1Handler) ChatCompletion

func (h *V1Handler) ChatCompletion(c *web.Context) error

ChatCompletion 处理聊天补全请求

@Tags			OpenAIV1
@Summary		处理聊天补全请求
@Description	处理聊天补全请求
@ID				chat-completion
@Accept			json
@Produce		json
@Success		200	{object}	web.Resp{}
@Router			/v1/chat/completions [post]

func (*V1Handler) Completions

func (h *V1Handler) Completions(c *web.Context) error

Completions 处理文本补全请求

@Tags			OpenAIV1
@Summary		处理文本补全请求
@Description	处理文本补全请求
@ID				completions
@Accept			json
@Produce		json
@Success		200	{object}	web.Resp{}
@Router			/v1/completions [post]

func (*V1Handler) CreateSecurityScanning

func (h *V1Handler) CreateSecurityScanning(c *web.Context, req domain.CreateSecurityScanningReq) error

CreateSecurityScanning 创建扫描任务

@Tags			OpenAIV1
@Summary		创建扫描任务
@Description	创建扫描任务
@ID				create-security-scanning
@Accept			json
@Produce		json
@Param			param	body		domain.CreateSecurityScanningReq	true	"创建扫描任务请求"
@Success		200		{object}	web.Resp{}
@Router			/v1/security/scanning [post]

func (*V1Handler) Embeddings

func (h *V1Handler) Embeddings(c *web.Context) error

Embeddings 处理嵌入请求

@Tags			OpenAIV1
@Summary		处理嵌入请求
@Description	处理嵌入请求
@ID				embeddings
@Accept			json
@Produce		json
@Success		200	{object}	web.Resp{}
@Router			/v1/embeddings [post]

func (*V1Handler) GetConfig

func (h *V1Handler) GetConfig(c *web.Context, req domain.ConfigReq) error

func (*V1Handler) HealthCheck

func (h *V1Handler) HealthCheck(c *web.Context) error

HealthCheck 健康检查

@Tags			OpenAIV1
@Summary		健康检查
@Description	固定回包 `{"code": 0, "data": "MonkeyCode"}`
@ID				health
@Accept			json
@Produce		json
@Success		200	{object}	web.Resp{}
@Router			/v1/health [get]

func (*V1Handler) ListSecurityScanning

func (h *V1Handler) ListSecurityScanning(c *web.Context, req domain.ListSecurityScanningReq) error

ListSecurityScanning 扫描任务列表

@Tags			OpenAIV1
@Summary		扫描任务列表
@Description	扫描任务列表
@ID				list-security-scanning
@Accept			json
@Produce		json
@Param			param	body		domain.ListSecurityScanningReq	true	"扫描任务列表请求"
@Success		200		{object}	web.Resp{data=domain.ListSecurityScanningBriefResp}
@Router			/v1/security/scanning [get]

func (*V1Handler) ListSecurityScanningDetail

func (h *V1Handler) ListSecurityScanningDetail(c *web.Context, req domain.ListSecurityScanningDetailReq) error

ListSecurityScanningDetail 获取扫描任务风险详情列表

@Tags			OpenAIV1
@Summary		获取扫描任务风险详情列表
@Description	分页只支持 next_token; 首页传空,后续判断has_next_page是否为true,传入回包给的next_token
@ID				list-security-scanning-detail
@Accept			json
@Produce		json
@Param			id	query		domain.ListSecurityScanningDetailReq	true	"扫描任务ID"
@Success		200	{object}	web.Resp{data=domain.ListSecurityScanningDetailResp}
@Router			/v1/security/scanning/detail [get]

func (*V1Handler) ModelList

func (h *V1Handler) ModelList(c *web.Context) error

ModelList 模型列表

@Tags			OpenAIV1
@Summary		模型列表
@Description	模型列表
@ID				model-list
@Accept			json
@Produce		json
@Success		200	{object}	web.Resp{data=domain.ModelListResp}
@Router			/v1/models [get]

func (*V1Handler) Report

func (h *V1Handler) Report(c *web.Context, req domain.ReportReq) error

Report 报告

@Tags			OpenAIV1
@Summary		报告
@Description	报告,支持多种操作:accept(接受补全)、suggest(建议)、reject(拒绝补全并记录用户输入)、file_written(文件写入)
@ID				report
@Accept			json
@Produce		json
@Param			param	body		domain.ReportReq	true	"报告请求"
@Success		200		{object}	web.Resp{}
@Router			/v1/report [post]

func (*V1Handler) Version

func (h *V1Handler) Version(c *web.Context) error

Jump to

Keyboard shortcuts

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