mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-11 22:08:16 +03:00
Update sing-box core, refactor MASQUE, update XHTTP
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//go:build !darwin
|
||||
//go:build !darwin || !cgo
|
||||
|
||||
package ccm
|
||||
|
||||
|
||||
@@ -124,8 +124,6 @@ type Service struct {
|
||||
userManager *UserManager
|
||||
accessMutex sync.RWMutex
|
||||
usageTracker *AggregatedUsage
|
||||
trackingGroup sync.WaitGroup
|
||||
shuttingDown bool
|
||||
}
|
||||
|
||||
func NewService(ctx context.Context, logger log.ContextLogger, tag string, options option.CCMServiceOptions) (adapter.Service, error) {
|
||||
@@ -283,8 +281,8 @@ func (s *Service) getAccessToken() (string, error) {
|
||||
|
||||
func detectContextWindow(betaHeader string, totalInputTokens int64) int {
|
||||
if totalInputTokens > premiumContextThreshold {
|
||||
features := strings.Split(betaHeader, ",")
|
||||
for _, feature := range features {
|
||||
features := strings.SplitSeq(betaHeader, ",")
|
||||
for feature := range features {
|
||||
if strings.HasPrefix(strings.TrimSpace(feature), "context-1m") {
|
||||
return contextWindowPremium
|
||||
}
|
||||
@@ -507,8 +505,8 @@ func (s *Service) handleResponseWithTracking(writer http.ResponseWriter, respons
|
||||
continue
|
||||
}
|
||||
|
||||
if bytes.HasPrefix(line, []byte("data: ")) {
|
||||
eventData := bytes.TrimPrefix(line, []byte("data: "))
|
||||
if after, ok0 := bytes.CutPrefix(line, []byte("data: ")); ok0 {
|
||||
eventData := after
|
||||
if bytes.Equal(eventData, []byte("[DONE]")) {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user