Commit 237f5994 by wzxjohn

fix(relay): wrong key param while enable sse

parent da54561b
...@@ -135,19 +135,27 @@ func (a *Adaptor) getRequestUrl(info *relaycommon.RelayInfo, modelName, suffix s ...@@ -135,19 +135,27 @@ func (a *Adaptor) getRequestUrl(info *relaycommon.RelayInfo, modelName, suffix s
), nil ), nil
} }
} else { } else {
var keyPrefix string
if strings.HasSuffix(suffix, "?alt=sse") {
keyPrefix = "&"
} else {
keyPrefix = "?"
}
if region == "global" { if region == "global" {
return fmt.Sprintf( return fmt.Sprintf(
"https://aiplatform.googleapis.com/v1/publishers/google/models/%s:%s?key=%s", "https://aiplatform.googleapis.com/v1/publishers/google/models/%s:%s%skey=%s",
modelName, modelName,
suffix, suffix,
keyPrefix,
info.ApiKey, info.ApiKey,
), nil ), nil
} else { } else {
return fmt.Sprintf( return fmt.Sprintf(
"https://%s-aiplatform.googleapis.com/v1/publishers/google/models/%s:%s?key=%s", "https://%s-aiplatform.googleapis.com/v1/publishers/google/models/%s:%s%skey=%s",
region, region,
modelName, modelName,
suffix, suffix,
keyPrefix,
info.ApiKey, info.ApiKey,
), nil ), nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment