支持LoraID , 通过OpenAI Client设置 ExtraHeader 并在讯飞实现中支持

This commit is contained in:
ybyang
2024-11-25 14:27:03 +08:00
parent 62ab7f47ad
commit ff24d0fab8
4 changed files with 13 additions and 6 deletions

View File

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