Remove vertexai_service_account_json from oai_settings. And google.js.
| @@ -237,7 +237,6 @@ const sensitiveFields = [ | |||
| 237 | 'custom_include_headers', | 237 | 'custom_include_headers', |
| 238 | 'vertexai_project_id', | 238 | 'vertexai_project_id', |
| 239 | 'vertexai_region', | 239 | 'vertexai_region', |
| 240 | 'vertexai_service_account_json', | ||
| 241 | ]; | 240 | ]; |
| 242 | 241 | ||
| 243 | /** | 242 | /** |
| @@ -312,7 +311,6 @@ export const settingsToUpdate = { | |||
| 312 | vertexai_auth_mode: ['#vertexai_auth_mode', 'vertexai_auth_mode', false, true], | 311 | vertexai_auth_mode: ['#vertexai_auth_mode', 'vertexai_auth_mode', false, true], |
| 313 | vertexai_project_id: ['#vertexai_project_id', 'vertexai_project_id', false, true], | 312 | vertexai_project_id: ['#vertexai_project_id', 'vertexai_project_id', false, true], |
| 314 | vertexai_region: ['#vertexai_region', 'vertexai_region', false, true], | 313 | vertexai_region: ['#vertexai_region', 'vertexai_region', false, true], |
| 315 | vertexai_service_account_json: ['#vertexai_service_account_json', 'vertexai_service_account_json', false, true], | ||
| 316 | use_alt_scale: ['#use_alt_scale', 'use_alt_scale', true, true], | 314 | use_alt_scale: ['#use_alt_scale', 'use_alt_scale', true, true], |
| 317 | squash_system_messages: ['#squash_system_messages', 'squash_system_messages', true, false], | 315 | squash_system_messages: ['#squash_system_messages', 'squash_system_messages', true, false], |
| 318 | image_inlining: ['#openai_image_inlining', 'image_inlining', true, false], | 316 | image_inlining: ['#openai_image_inlining', 'image_inlining', true, false], |
| @@ -397,7 +395,6 @@ const default_settings = { | |||
| 397 | vertexai_auth_mode: 'express', | 395 | vertexai_auth_mode: 'express', |
| 398 | vertexai_project_id: '', | 396 | vertexai_project_id: '', |
| 399 | vertexai_region: 'us-central1', | 397 | vertexai_region: 'us-central1', |
| 400 | vertexai_service_account_json: '', | ||
| 401 | use_alt_scale: false, | 398 | use_alt_scale: false, |
| 402 | squash_system_messages: false, | 399 | squash_system_messages: false, |
| 403 | image_inlining: false, | 400 | image_inlining: false, |
| @@ -485,7 +482,6 @@ const oai_settings = { | |||
| 485 | vertexai_auth_mode: 'express', | 482 | vertexai_auth_mode: 'express', |
| 486 | vertexai_project_id: '', | 483 | vertexai_project_id: '', |
| 487 | vertexai_region: 'us-central1', | 484 | vertexai_region: 'us-central1', |
| 488 | vertexai_service_account_json: '', | ||
| 489 | use_alt_scale: false, | 485 | use_alt_scale: false, |
| 490 | squash_system_messages: false, | 486 | squash_system_messages: false, |
| 491 | image_inlining: false, | 487 | image_inlining: false, |
| @@ -3836,7 +3832,6 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) { | |||
| 3836 | vertexai_auth_mode: settings.vertexai_auth_mode, | 3832 | vertexai_auth_mode: settings.vertexai_auth_mode, |
| 3837 | vertexai_project_id: settings.vertexai_project_id, | 3833 | vertexai_project_id: settings.vertexai_project_id, |
| 3838 | vertexai_region: settings.vertexai_region, | 3834 | vertexai_region: settings.vertexai_region, |
| 3839 | vertexai_service_account_json: settings.vertexai_service_account_json, | ||
| 3840 | use_alt_scale: settings.use_alt_scale, | 3835 | use_alt_scale: settings.use_alt_scale, |
| 3841 | squash_system_messages: settings.squash_system_messages, | 3836 | squash_system_messages: settings.squash_system_messages, |
| 3842 | image_inlining: settings.image_inlining, | 3837 | image_inlining: settings.image_inlining, |
| @@ -5586,10 +5581,6 @@ async function onVertexAIValidateServiceAccount() { | |||
| 5586 | // Save to backend secret storage | 5581 | // Save to backend secret storage |
| 5587 | await writeSecret(SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT, jsonContent); | 5582 | await writeSecret(SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT, jsonContent); |
| 5588 | 5583 | ||
| 5589 | // Clear the textarea and update settings | ||
| 5590 | $('#vertexai_service_account_json').val(''); | ||
| 5591 | oai_settings.vertexai_service_account_json = ''; | ||
| 5592 | |||
| 5593 | // Show success status | 5584 | // Show success status |
| 5594 | updateVertexAIServiceAccountStatus(true, `Project: ${serviceAccount.project_id}, Email: ${serviceAccount.client_email}`); | 5585 | updateVertexAIServiceAccountStatus(true, `Project: ${serviceAccount.project_id}, Email: ${serviceAccount.client_email}`); |
| 5595 | 5586 | ||
| @@ -5607,7 +5598,6 @@ async function onVertexAIValidateServiceAccount() { | |||
| 5607 | */ | 5598 | */ |
| 5608 | async function onVertexAIClearServiceAccount() { | 5599 | async function onVertexAIClearServiceAccount() { |
| 5609 | $('#vertexai_service_account_json').val(''); | 5600 | $('#vertexai_service_account_json').val(''); |
| 5610 | oai_settings.vertexai_service_account_json = ''; | ||
| 5611 | 5601 | ||
| 5612 | // Clear from backend secret storage | 5602 | // Clear from backend secret storage |
| 5613 | await writeSecret(SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT, ''); | 5603 | await writeSecret(SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT, ''); |
| @@ -5622,8 +5612,6 @@ async function onVertexAIClearServiceAccount() { | |||
| 5622 | */ | 5612 | */ |
| 5623 | function onVertexAIServiceAccountJsonChange() { | 5613 | function onVertexAIServiceAccountJsonChange() { |
| 5624 | const jsonContent = String($(this).val()).trim(); | 5614 | const jsonContent = String($(this).val()).trim(); |
| 5625 | // Don't save to settings automatically - only save when validated | ||
| 5626 | // oai_settings.vertexai_service_account_json = jsonContent; | ||
| 5627 | 5615 | ||
| 5628 | if (jsonContent) { | 5616 | if (jsonContent) { |
| 5629 | // Auto-validate when content is pasted | 5617 | // Auto-validate when content is pasted |
| @@ -31,13 +31,8 @@ export async function getVertexAIAuth(request) { | |||
| 31 | } | 31 | } |
| 32 | throw new Error('API key is required for Vertex AI Express mode'); | 32 | throw new Error('API key is required for Vertex AI Express mode'); |
| 33 | } else if (authMode === 'full') { | 33 | } else if (authMode === 'full') { |
| 34 | // Try to get service account JSON from backend storage first | 34 | // Get service account JSON from backend storage |
| 35 | let serviceAccountJson = readSecret(request.user.directories, SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT); | 35 | const serviceAccountJson = readSecret(request.user.directories, SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT); |
| 36 | |||
| 37 | // If not found in backend storage, try from request body (for backward compatibility) | ||
| 38 | if (!serviceAccountJson) { | ||
| 39 | serviceAccountJson = request.body.vertexai_service_account_json; | ||
| 40 | } | ||
| 41 | 36 | ||
| 42 | if (serviceAccountJson) { | 37 | if (serviceAccountJson) { |
| 43 | try { | 38 | try { |