diff --git a/proto/im.go b/proto/im.go index 201bb3f..6ec1d39 100644 --- a/proto/im.go +++ b/proto/im.go @@ -41,6 +41,21 @@ type ModelParam struct { TopP float64 `json:"topP"` //取 } +func (m *ModelParam) SetDefaultParams() { + if m.Temperature == 0 { + m.Temperature = DefaultTemperature + } + if m.MaxTokens == 0 { + m.MaxTokens = DefaultMaxTokens + } + if m.TopK == 0 { + m.TopK = DefaultTopK + } + if m.TopP == 0 { + m.TopP = DefaultTopP + } +} + type SessionResponse struct { gorm.Model UserID int `gorm:"column:user_id"` //只能由用户创建 diff --git a/proto/status.go b/proto/status.go index 4327d56..ea708c3 100644 --- a/proto/status.go +++ b/proto/status.go @@ -130,3 +130,11 @@ const ( SparkContextLength = 6 DouBaoContextLength = 6 ) + +// 模型参数 +const ( + DefaultTemperature = 0.5 + DefaultMaxTokens = 4096 + DefaultTopK = 0.5 + DefaultTopP = 0.8 +)