mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-13 19:46:16 +03:00
refactor(ai): default Vertex location to global in shared helper (#54171)
This commit is contained in:
committed by
GitHub
Unverified
parent
d2905b8dda
commit
744aa0cd2a
@@ -47,7 +47,7 @@ const configuredRoute = (input: Config) => {
|
||||
project: inputProject,
|
||||
...rest
|
||||
} = input
|
||||
const location = GoogleVertexShared.location(inputLocation, "global")
|
||||
const location = GoogleVertexShared.location(inputLocation)
|
||||
const project = GoogleVertexShared.project(inputProject)
|
||||
return route.with({
|
||||
...rest,
|
||||
|
||||
@@ -77,7 +77,7 @@ const configuredRoute = (input: Config) => {
|
||||
project: inputProject,
|
||||
...rest
|
||||
} = input
|
||||
const location = GoogleVertexShared.location(inputLocation, "global")
|
||||
const location = GoogleVertexShared.location(inputLocation)
|
||||
const project = GoogleVertexShared.project(inputProject)
|
||||
return route.with({
|
||||
...rest,
|
||||
|
||||
@@ -63,8 +63,7 @@ const configuredRoute = (input: Config) => {
|
||||
project: inputProject,
|
||||
...rest
|
||||
} = input
|
||||
// Mistral is served from regional endpoints only; the global endpoint returns 404.
|
||||
const location = GoogleVertexShared.location(inputLocation, "us-central1")
|
||||
const location = GoogleVertexShared.location(inputLocation)
|
||||
const project = GoogleVertexShared.project(inputProject)
|
||||
return route.with({
|
||||
...rest,
|
||||
|
||||
@@ -48,7 +48,7 @@ const configuredRoute = (input: Config) => {
|
||||
project: inputProject,
|
||||
...rest
|
||||
} = input
|
||||
const location = GoogleVertexShared.location(inputLocation, "global")
|
||||
const location = GoogleVertexShared.location(inputLocation)
|
||||
const project = GoogleVertexShared.project(inputProject)
|
||||
return route.with({
|
||||
...rest,
|
||||
|
||||
@@ -21,12 +21,12 @@ export const project = (value?: string) =>
|
||||
process.env.GCP_PROJECT ??
|
||||
process.env.GCLOUD_PROJECT
|
||||
|
||||
export const location = (value: string | undefined, fallback: string) =>
|
||||
export const location = (value: string | undefined) =>
|
||||
value ??
|
||||
process.env.GOOGLE_VERTEX_LOCATION ??
|
||||
process.env.GOOGLE_CLOUD_LOCATION ??
|
||||
process.env.VERTEX_LOCATION ??
|
||||
fallback
|
||||
"global"
|
||||
|
||||
export const host = (location: string) => {
|
||||
if (location === "global") return "aiplatform.googleapis.com"
|
||||
|
||||
@@ -91,7 +91,7 @@ const configuredRoute = (input: Config, modelID: string | ModelID) => {
|
||||
provider: id,
|
||||
message: "Google Vertex tuned models do not support Express Mode API keys",
|
||||
})
|
||||
const location = GoogleVertexShared.location(inputLocation, "global")
|
||||
const location = GoogleVertexShared.location(inputLocation)
|
||||
const project = GoogleVertexShared.project(inputProject)
|
||||
const endpoint =
|
||||
baseURL ??
|
||||
|
||||
Reference in New Issue
Block a user