From cae326a598cc738880f53a9f3f7d879f22954fd4 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Fri, 28 Mar 2025 16:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=8F=82=E6=95=B0=E4=B8=AD?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=9F=BA=E6=9C=AC=E5=8F=82=E6=95=B0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/im.go | 15 +++++++++++++++ proto/status.go | 8 ++++++++ 2 files changed, 23 insertions(+) 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 +)