Merge branch 'main' into doubao-cache

This commit is contained in:
Laoshancun
2025-02-08 14:04:26 +08:00
committed by GitHub
107 changed files with 7220 additions and 3616 deletions

View File

@@ -1,12 +1,15 @@
package meta
import (
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/songquanpeng/one-api/common/ctxkey"
"github.com/songquanpeng/one-api/model"
"github.com/songquanpeng/one-api/relay/channeltype"
"github.com/songquanpeng/one-api/relay/relaymode"
"strings"
)
type Meta struct {
@@ -32,6 +35,7 @@ type Meta struct {
PromptTokens int // only for DoResponse
SystemPrompt string
Cache bool
StartTime time.Time
}
func GetByContext(c *gin.Context) *Meta {
@@ -49,6 +53,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),
StartTime: time.Now(),
}
cfg, ok := c.Get(ctxkey.Config)
if ok {