pet-ai/server/model/pet/request/chat_request.go

61 lines
3.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package request
import (
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
)
// ChatRequest 宠物助手聊天请求结构体
type ChatRequest struct {
Message string `json:"message" binding:"required" validate:"required,min=1,max=2000"` // 用户消息内容必填1-2000字符
SessionId string `json:"sessionId" validate:"omitempty,uuid4"` // 会话ID可选UUID格式
Stream bool `json:"stream"` // 是否流式响应默认false
Temperature float64 `json:"temperature" validate:"omitempty,min=0,max=2"` // 温度参数控制随机性范围0-2
MaxTokens int `json:"maxTokens" validate:"omitempty,min=1,max=4000"` // 最大生成token数范围1-4000
Model string `json:"model" validate:"omitempty,min=1,max=100"` // 模型名称,可选
TopP float64 `json:"topP" validate:"omitempty,min=0,max=1"` // 核采样参数范围0-1
}
// ChatHistoryRequest 获取聊天历史请求结构体
type ChatHistoryRequest struct {
SessionId string `json:"sessionId" form:"sessionId" validate:"omitempty,uuid4"` // 会话ID可选UUID格式
request.PageInfo // 分页信息
}
// ClearHistoryRequest 清空聊天历史请求结构体
type ClearHistoryRequest struct {
SessionId string `json:"sessionId" form:"sessionId" validate:"omitempty,uuid4"` // 会话ID可选不传则清空所有会话
}
// SessionsRequest 获取会话列表请求结构体
type SessionsRequest struct {
request.PageInfo // 分页信息
}
// StopGenerationRequest 停止生成请求结构体
type StopGenerationRequest struct {
RequestId string `json:"requestId" binding:"required" validate:"required,uuid4"` // 请求ID必填UUID格式
}
// RegenerateRequest 重新生成回复请求结构体
type RegenerateRequest struct {
SessionId string `json:"sessionId" binding:"required" validate:"required,uuid4"` // 会话ID必填
MessageId uint `json:"messageId" binding:"required" validate:"required,min=1"` // 要重新生成的消息ID
Temperature float64 `json:"temperature" validate:"omitempty,min=0,max=2"` // 温度参数
MaxTokens int `json:"maxTokens" validate:"omitempty,min=1,max=4000"` // 最大token数
}
// FeedbackRequest 用户反馈请求结构体
type FeedbackRequest struct {
MessageId uint `json:"messageId" binding:"required" validate:"required,min=1"` // 消息ID必填
FeedbackType string `json:"feedbackType" binding:"required" validate:"required,oneof=like dislike"` // 反馈类型like/dislike
Comment string `json:"comment" validate:"omitempty,max=500"` // 反馈评论可选最多500字符
}
// ExportHistoryRequest 导出聊天历史请求结构体
type ExportHistoryRequest struct {
SessionId string `json:"sessionId" form:"sessionId" validate:"omitempty,uuid4"` // 会话ID可选
Format string `json:"format" form:"format" validate:"omitempty,oneof=json txt markdown"` // 导出格式json/txt/markdown
StartTime string `json:"startTime" form:"startTime" validate:"omitempty,datetime=2006-01-02"` // 开始时间,可选
EndTime string `json:"endTime" form:"endTime" validate:"omitempty,datetime=2006-01-02"` // 结束时间,可选
}