Skip to content

Commit 24d25e4

Browse files
committed
fix: address cursor bot review feedback
1. Fix Hunyuan provider never showing as configured - Add HUNYUAN_CONFIGURED placeholder when credentials provided 2. Fix configured status ignoring missing credentials - Bedrock: Check access key/secret or bearer token before marking configured - Vertex: Check auth key and service name before marking configured - Add similar checks for Cloudflare and DeepL providers 3. Fix multi-line JSON input issue for Vertex - Change from direct JSON paste to file path input - Read and compact JSON file content to single line
1 parent 4917a6c commit 24d25e4

1 file changed

Lines changed: 35 additions & 11 deletions

File tree

all-in-one/get-ai-gateway.sh

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,18 @@ configureBedrockProvider() {
281281
if [ "$BEDROCK_AUTH_METHOD" == "2" ]; then
282282
read -r -u 3 -p "→ Enter AWS Bearer Token: " BEDROCK_API_KEY
283283
LLM_ENVS+=("BEDROCK_API_KEY")
284+
read -r -u 3 -p "→ Enter AWS Region (e.g., us-east-1): " BEDROCK_REGION
285+
if [ -n "$BEDROCK_API_KEY" ] && [ -n "$BEDROCK_REGION" ]; then
286+
BEDROCK_CONFIGURED="placeholder"
287+
fi
284288
else
285289
read -r -u 3 -p "→ Enter AWS Access Key: " BEDROCK_ACCESS_KEY
286290
read -r -u 3 -p "→ Enter AWS Secret Key: " BEDROCK_SECRET_KEY
287291
LLM_ENVS+=("BEDROCK_ACCESS_KEY" "BEDROCK_SECRET_KEY")
288-
fi
289-
read -r -u 3 -p "→ Enter AWS Region (e.g., us-east-1): " BEDROCK_REGION
290-
if [ -n "$BEDROCK_REGION" ]; then
291-
BEDROCK_CONFIGURED="placeholder"
292+
read -r -u 3 -p "→ Enter AWS Region (e.g., us-east-1): " BEDROCK_REGION
293+
if [ -n "$BEDROCK_ACCESS_KEY" ] && [ -n "$BEDROCK_SECRET_KEY" ] && [ -n "$BEDROCK_REGION" ]; then
294+
BEDROCK_CONFIGURED="placeholder"
295+
fi
292296
fi
293297
LLM_ENVS+=("BEDROCK_REGION")
294298
}
@@ -301,29 +305,46 @@ configureVertexProvider() {
301305
if [ "$VERTEX_AUTH_MODE" == "2" ]; then
302306
read -r -u 3 -p "→ Enter Vertex AI API Key: " VERTEX_API_KEY
303307
LLM_ENVS+=("VERTEX_API_KEY")
308+
read -r -u 3 -p "→ Enter Google Cloud Region (e.g., us-central1): " VERTEX_REGION
309+
read -r -u 3 -p "→ Enter Google Cloud Project ID: " VERTEX_PROJECT_ID
310+
if [ -n "$VERTEX_API_KEY" ] && [ -n "$VERTEX_REGION" ] && [ -n "$VERTEX_PROJECT_ID" ]; then
311+
VERTEX_CONFIGURED="placeholder"
312+
fi
304313
else
305-
echo "→ Enter Service Account JSON Key (paste the entire JSON content, then press Enter):"
306-
read -r -u 3 VERTEX_AUTH_KEY
314+
read -r -u 3 -p "→ Enter path to Service Account JSON Key file: " VERTEX_AUTH_KEY_FILE
315+
if [ -n "$VERTEX_AUTH_KEY_FILE" ] && [ -f "$VERTEX_AUTH_KEY_FILE" ]; then
316+
# Read JSON file and compact it to a single line
317+
VERTEX_AUTH_KEY=$(cat "$VERTEX_AUTH_KEY_FILE" | tr -d '\n' | tr -s ' ')
318+
else
319+
echo "Warning: File not found or not specified. Please configure manually later."
320+
VERTEX_AUTH_KEY=""
321+
fi
307322
read -r -u 3 -p "→ Enter Vertex AI Auth Service Name: " VERTEX_AUTH_SERVICE_NAME
308323
LLM_ENVS+=("VERTEX_AUTH_KEY" "VERTEX_AUTH_SERVICE_NAME")
309-
fi
310-
read -r -u 3 -p "→ Enter Google Cloud Region (e.g., us-central1): " VERTEX_REGION
311-
read -r -u 3 -p "→ Enter Google Cloud Project ID: " VERTEX_PROJECT_ID
312-
if [ -n "$VERTEX_REGION" ] && [ -n "$VERTEX_PROJECT_ID" ]; then
313-
VERTEX_CONFIGURED="placeholder"
324+
read -r -u 3 -p "→ Enter Google Cloud Region (e.g., us-central1): " VERTEX_REGION
325+
read -r -u 3 -p "→ Enter Google Cloud Project ID: " VERTEX_PROJECT_ID
326+
if [ -n "$VERTEX_AUTH_KEY" ] && [ -n "$VERTEX_AUTH_SERVICE_NAME" ] && [ -n "$VERTEX_REGION" ] && [ -n "$VERTEX_PROJECT_ID" ]; then
327+
VERTEX_CONFIGURED="placeholder"
328+
fi
314329
fi
315330
LLM_ENVS+=("VERTEX_REGION" "VERTEX_PROJECT_ID")
316331
}
317332

318333
configureCloudflareProvider() {
319334
read -r -u 3 -p "→ Enter API Token for Cloudflare Workers AI: " CLOUDFLARE_API_KEY
320335
read -r -u 3 -p "→ Enter Cloudflare Account ID: " CLOUDFLARE_ACCOUNT_ID
336+
if [ -n "$CLOUDFLARE_API_KEY" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ]; then
337+
CLOUDFLARE_CONFIGURED="placeholder"
338+
fi
321339
LLM_ENVS+=("CLOUDFLARE_API_KEY" "CLOUDFLARE_ACCOUNT_ID")
322340
}
323341

324342
configureDeepLProvider() {
325343
read -r -u 3 -p "→ Enter API Key for DeepL: " DEEPL_API_KEY
326344
read -r -u 3 -p "→ Enter target language for DeepL (e.g., EN, ZH, JA): " DEEPL_TARGET_LANG
345+
if [ -n "$DEEPL_API_KEY" ] && [ -n "$DEEPL_TARGET_LANG" ]; then
346+
DEEPL_CONFIGURED="placeholder"
347+
fi
327348
LLM_ENVS+=("DEEPL_API_KEY" "DEEPL_TARGET_LANG")
328349
}
329350

@@ -357,6 +378,9 @@ configureSparkProvider() {
357378
configureHunyuanProvider() {
358379
read -r -u 3 -p "→ Enter Auth ID for Tencent Hunyuan: " HUNYUAN_AUTH_ID
359380
read -r -u 3 -p "→ Enter Auth Key for Tencent Hunyuan: " HUNYUAN_AUTH_KEY
381+
if [ -n "$HUNYUAN_AUTH_ID" ] && [ -n "$HUNYUAN_AUTH_KEY" ]; then
382+
HUNYUAN_CONFIGURED="placeholder"
383+
fi
360384
LLM_ENVS+=("HUNYUAN_AUTH_ID" "HUNYUAN_AUTH_KEY")
361385
}
362386

0 commit comments

Comments
 (0)