fix: baidu api issue (#1685)

This commit is contained in:
Se7en
2025-01-16 21:42:43 +08:00
committed by GitHub
parent 9e418dafd9
commit ba74f4bbb9
28 changed files with 33 additions and 33 deletions

View File

@@ -8,7 +8,7 @@ import (
"net/http"
"strings"
"time"
"github.com/alibaba/higress/plugins/wasm-go/extensions/ai-proxy/util"
"github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
"github.com/google/uuid"
@@ -558,7 +558,8 @@ func (c *ProviderConfig) GetApiTokenInUse(ctx wrapper.HttpContext) string {
func (c *ProviderConfig) SetApiTokenInUse(ctx wrapper.HttpContext, log wrapper.Log) {
var apiToken string
if c.isFailoverEnabled() || c.useGlobalApiToken {
// if enable apiToken failover, only use available apiToken
// if enable apiToken failover, only use available apiToken from global apiTokens list
// or the apiToken need to be accessed globally (via all Wasm VMs, e.g. baidu),
apiToken = c.GetGlobalRandomToken(log)
} else {
apiToken = c.GetRandomToken()