Documentation
¶
Overview ¶
Deprecated: 不再维护,逐步迁移到 github.com/MeowSalty/pinai/handlers/multi 包。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListModels ¶
ListModels 处理获取可用模型列表的请求 @Summary 列出模型 @Description 获取所有可用的 AI 模型列表 @Tags Anthropic @Accept json @Produce json @Success 200 {object} ModelList @Failure 500 {object} fiber.Map @Router /anthropic/v1/models [get]
Types ¶
type AnthropicHandler ¶
type AnthropicHandler struct {
// contains filtered or unexported fields
}
AnthropicHandler 结构体定义了 Anthropic 兼容 API 的处理器
该结构体封装了处理 Anthropic 兼容 API 请求所需的服务和日志记录器
func New ¶
func New(portal portal.Service, userAgent string) *AnthropicHandler
New 创建并初始化一个新的 Anthropic API 处理器实例
该函数使用依赖注入的方式创建 AnthropicHandler 实例
参数:
- portal: AI 网关服务实例,用于处理 AI 相关请求
- userAgent: User-Agent 配置,空则透传客户端 UA,"default" 使用 fasthttp 默认值,其他字符串则复写
返回值:
- *AnthropicHandler: 初始化后的 Anthropic 处理器实例
func (*AnthropicHandler) Messages ¶
func (h *AnthropicHandler) Messages(c *fiber.Ctx) error
Messages 处理消息完成请求 @Summary 消息完成 @Description 创建消息完成响应 @Tags Anthropic @Accept json @Produce json @Param request body anthropicTypes.MessageRequest true "消息请求" @Success 200 {object} anthropicTypes.MessageResponse @Failure 400 {object} fiber.Map @Failure 401 {object} fiber.Map @Failure 500 {object} fiber.Map @Router /anthropic/v1/messages [post]