fix(image-analysis): clear runtime env on native-read fallback

Avoid carrying runtime API credentials and endpoint fields into native Read fallback launches.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
walker1211andClaude Opus 4.7 committed 2026-04-22 01:25:32 +08:00
1 parent d8954e9453
commit 63082d4aed
1 file changed
+6 -4
@@ -109,9 +109,12 @@ export function getImageAnalysisHookEnv(
: resolveImageAnalysisStatus({ profileName: '' }, config); : resolveImageAnalysisStatus({ profileName: '' }, config);
const skipImageAnalysis = !status.supported; const skipImageAnalysis = !status.supported;
const runtimeApiKey = const runtimeApiKey =
typeof context === 'object' && context.cliproxyBridge !skipImageAnalysis && typeof context === 'object' && context.cliproxyBridge
? resolveCliproxyBridgeProfile(context.cliproxyBridge.provider).apiKey ? resolveCliproxyBridgeProfile(context.cliproxyBridge.provider).apiKey
: ''; : '';
const runtimePath = skipImageAnalysis ? '' : status.runtimePath || '';
const runtimeBaseUrl =
skipImageAnalysis || typeof context !== 'object' ? '' : context.cliproxyBridge?.currentBaseUrl || '';
return { return {
CCS_IMAGE_ANALYSIS_ENABLED: config.enabled ? '1' : '0', CCS_IMAGE_ANALYSIS_ENABLED: config.enabled ? '1' : '0',
@@ -120,9 +123,8 @@ export function getImageAnalysisHookEnv(
CCS_CURRENT_PROVIDER: status.backendId || '', CCS_CURRENT_PROVIDER: status.backendId || '',
CCS_IMAGE_ANALYSIS_BACKEND_ID: status.backendId || '', CCS_IMAGE_ANALYSIS_BACKEND_ID: status.backendId || '',
CCS_IMAGE_ANALYSIS_MODEL: status.model || '', CCS_IMAGE_ANALYSIS_MODEL: status.model || '',
CCS_IMAGE_ANALYSIS_RUNTIME_PATH: status.runtimePath || '', CCS_IMAGE_ANALYSIS_RUNTIME_PATH: runtimePath,
CCS_IMAGE_ANALYSIS_RUNTIME_BASE_URL: CCS_IMAGE_ANALYSIS_RUNTIME_BASE_URL: runtimeBaseUrl,
typeof context === 'object' ? context.cliproxyBridge?.currentBaseUrl || '' : '',
...(runtimeApiKey ? { CCS_IMAGE_ANALYSIS_RUNTIME_API_KEY: runtimeApiKey } : {}), ...(runtimeApiKey ? { CCS_IMAGE_ANALYSIS_RUNTIME_API_KEY: runtimeApiKey } : {}),
CCS_IMAGE_ANALYSIS_PROMPTS_DIR: getPromptsDir(), CCS_IMAGE_ANALYSIS_PROMPTS_DIR: getPromptsDir(),
CCS_IMAGE_ANALYSIS_SKIP: skipImageAnalysis ? '1' : '0', CCS_IMAGE_ANALYSIS_SKIP: skipImageAnalysis ? '1' : '0',