feat: support set system prompt for channel (close #1920)

This commit is contained in:
JustSong
2024-11-10 14:53:34 +08:00
parent 92cd46d64f
commit 6eb0770a89
8 changed files with 44 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ type Meta struct {
ActualModelName string
RequestURLPath string
PromptTokens int // only for DoResponse
SystemPrompt string
}
func GetByContext(c *gin.Context) *Meta {
@@ -46,6 +47,7 @@ func GetByContext(c *gin.Context) *Meta {
BaseURL: c.GetString(ctxkey.BaseURL),
APIKey: strings.TrimPrefix(c.Request.Header.Get("Authorization"), "Bearer "),
RequestURLPath: c.Request.URL.String(),
SystemPrompt: c.GetString(ctxkey.SystemPrompt),
}
cfg, ok := c.Get(ctxkey.Config)
if ok {