35 lines
937 B
Go
35 lines
937 B
Go
package util
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
)
|
|
|
|
// GetServerName 获取服务名称
|
|
func GetServerName(ctx context.Context) string {
|
|
return g.Cfg().MustGet(ctx, "server.name", "").String()
|
|
}
|
|
|
|
// GetModelPrompt 获取请求模型的提示词
|
|
func GetModelPrompt(ctx context.Context, modelType int) string {
|
|
key := "modelPrompts.types." + gconv.String(modelType)
|
|
return g.Cfg().MustGet(ctx, key, "").String()
|
|
}
|
|
|
|
// GetBuildPrompt 获取节点构建提示词
|
|
func GetBuildPrompt(ctx context.Context) string {
|
|
return g.Cfg().MustGet(ctx, "nodePrompts", "").String()
|
|
}
|
|
|
|
// GetMaxRounds 获取最大轮数配置
|
|
func GetMaxRounds(ctx context.Context) int {
|
|
return g.Cfg().MustGet(ctx, "session.maxRounds", 10).Int()
|
|
}
|
|
|
|
// GetExpireMinutes 获取过期时间配置
|
|
func GetExpireMinutes(ctx context.Context) int {
|
|
return g.Cfg().MustGet(ctx, "session.expireMinutes", 30).Int()
|
|
}
|