feat: 新增API Key认证支持,优化Swagger文档安全配置
This commit is contained in:
@@ -49,6 +49,7 @@ func NewHandler(
|
||||
// @Success 201 {object} map[string]interface{} "创建的会话"
|
||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions [post]
|
||||
func (h *Handler) CreateSession(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
@@ -207,6 +208,7 @@ func (h *Handler) applyConversationDefaults(ctx context.Context, session *types.
|
||||
// @Success 200 {object} map[string]interface{} "会话详情"
|
||||
// @Failure 404 {object} errors.AppError "会话不存在"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{id} [get]
|
||||
func (h *Handler) GetSession(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
@@ -254,6 +256,7 @@ func (h *Handler) GetSession(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{} "会话列表"
|
||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions [get]
|
||||
func (h *Handler) GetSessionsByTenant(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
@@ -295,6 +298,7 @@ func (h *Handler) GetSessionsByTenant(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{} "更新后的会话"
|
||||
// @Failure 404 {object} errors.AppError "会话不存在"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{id} [put]
|
||||
func (h *Handler) UpdateSession(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
@@ -356,6 +360,7 @@ func (h *Handler) UpdateSession(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{} "删除成功"
|
||||
// @Failure 404 {object} errors.AppError "会话不存在"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{id} [delete]
|
||||
func (h *Handler) DeleteSession(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
// @Success 200 {object} map[string]interface{} "搜索结果"
|
||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/search [post]
|
||||
func (h *Handler) SearchKnowledge(c *gin.Context) {
|
||||
ctx := logger.CloneContext(c.Request.Context())
|
||||
@@ -88,6 +89,7 @@ func (h *Handler) SearchKnowledge(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{} "问答结果(SSE流)"
|
||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{session_id}/knowledge-qa [post]
|
||||
func (h *Handler) KnowledgeQA(c *gin.Context) {
|
||||
ctx := logger.CloneContext(c.Request.Context())
|
||||
@@ -170,6 +172,7 @@ func (h *Handler) KnowledgeQA(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{} "问答结果(SSE流)"
|
||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{session_id}/agent-qa [post]
|
||||
func (h *Handler) AgentQA(c *gin.Context) {
|
||||
ctx := logger.CloneContext(c.Request.Context())
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
// @Success 200 {object} map[string]interface{} "流式响应"
|
||||
// @Failure 404 {object} errors.AppError "会话或消息不存在"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{session_id}/continue [get]
|
||||
func (h *Handler) ContinueStream(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
@@ -185,6 +186,7 @@ func (h *Handler) ContinueStream(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{} "停止成功"
|
||||
// @Failure 404 {object} errors.AppError "会话或消息不存在"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{session_id}/stop [post]
|
||||
func (h *Handler) StopSession(c *gin.Context) {
|
||||
ctx := logger.CloneContext(c.Request.Context())
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
// @Success 200 {object} map[string]interface{} "生成的标题"
|
||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||
// @Security Bearer
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /sessions/{session_id}/title [post]
|
||||
func (h *Handler) GenerateTitle(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
|
||||
Reference in New Issue
Block a user