Merge pull request #1113 from tbphp/tbphp_vertex_gemini_global_region

fix: Vertex channel global region format
This commit is contained in:
IcedTangerine
2025-05-28 14:16:47 +08:00
committed by GitHub

View File

@@ -95,6 +95,14 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
} else { } else {
suffix = "generateContent" suffix = "generateContent"
} }
if region == "global" {
return fmt.Sprintf(
"https://aiplatform.googleapis.com/v1/projects/%s/locations/global/publishers/google/models/%s:%s",
adc.ProjectID,
info.UpstreamModelName,
suffix,
), nil
} else {
return fmt.Sprintf( return fmt.Sprintf(
"https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s", "https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s",
region, region,
@@ -103,6 +111,7 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
info.UpstreamModelName, info.UpstreamModelName,
suffix, suffix,
), nil ), nil
}
} else if a.RequestMode == RequestModeClaude { } else if a.RequestMode == RequestModeClaude {
if info.IsStream { if info.IsStream {
suffix = "streamRawPredict?alt=sse" suffix = "streamRawPredict?alt=sse"