diff --git a/backend/app/controller/electron_browser.cjs b/backend/app/controller/electron_browser.cjs index 5b4fc698c..06b50fb1e 100644 --- a/backend/app/controller/electron_browser.cjs +++ b/backend/app/controller/electron_browser.cjs @@ -9,6 +9,8 @@ const startUrl = args[2] || 'https://www.google.com'; // This must be called before app.ready app.commandLine.appendSwitch('remote-debugging-port', cdpPort); +app.commandLine.appendSwitch('password-store', 'basic'); +app.commandLine.appendSwitch('use-mock-keychain'); console.log('[ELECTRON BROWSER] Starting with:'); console.log(' Chrome version:', process.versions.chrome); @@ -36,8 +38,14 @@ app.whenReady().then(async () => { // Check command line switches console.log('[ELECTRON BROWSER] Command line switches:'); - console.log(' user-data-dir:', app.commandLine.getSwitchValue('user-data-dir')); - console.log(' remote-debugging-port:', app.commandLine.getSwitchValue('remote-debugging-port')); + console.log( + ' user-data-dir:', + app.commandLine.getSwitchValue('user-data-dir') + ); + console.log( + ' remote-debugging-port:', + app.commandLine.getSwitchValue('remote-debugging-port') + ); // Log partition session info const userLoginSession = session.fromPartition('persist:user_login'); @@ -46,7 +54,12 @@ app.whenReady().then(async () => { console.log(' Session storage path:', userLoginSession.getStoragePath()); // Check if Cookies file exists - const cookiesPath = path.join(app.getPath('userData'), 'Partitions', 'user_login', 'Cookies'); + const cookiesPath = path.join( + app.getPath('userData'), + 'Partitions', + 'user_login', + 'Cookies' + ); console.log('[ELECTRON BROWSER] Cookies path:', cookiesPath); console.log('[ELECTRON BROWSER] Cookies exists:', fs.existsSync(cookiesPath)); if (fs.existsSync(cookiesPath)) { @@ -60,8 +73,8 @@ app.whenReady().then(async () => { webPreferences: { nodeIntegration: true, contextIsolation: false, - webviewTag: true - } + webviewTag: true, + }, }); // Create navigation bar and webview HTML @@ -305,9 +318,14 @@ app.whenReady().then(async () => { setInterval(async () => { try { const cookies = await userLoginSession.cookies.get({}); - console.log('[ELECTRON BROWSER] Current cookies count:', cookies.length); + console.log( + '[ELECTRON BROWSER] Current cookies count:', + cookies.length + ); if (cookies.length > 0) { - console.log('[ELECTRON BROWSER] Cookie domains:', [...new Set(cookies.map(c => c.domain))]); + console.log('[ELECTRON BROWSER] Cookie domains:', [ + ...new Set(cookies.map((c) => c.domain)), + ]); } } catch (error) { console.error('[ELECTRON BROWSER] Failed to get cookies:', error); @@ -327,7 +345,10 @@ app.whenReady().then(async () => { // Log cookies before flush const cookiesBeforeFlush = await userLoginSession.cookies.get({}); - console.log('[ELECTRON BROWSER] Cookies count before flush:', cookiesBeforeFlush.length); + console.log( + '[ELECTRON BROWSER] Cookies count before flush:', + cookiesBeforeFlush.length + ); // Flush storage console.log('[ELECTRON BROWSER] Flushing storage data...'); @@ -335,12 +356,23 @@ app.whenReady().then(async () => { console.log('[ELECTRON BROWSER] Storage data flushed successfully'); // Check cookies file after flush - const cookiesPath = path.join(app.getPath('userData'), 'Partitions', 'user_login', 'Cookies'); + const cookiesPath = path.join( + app.getPath('userData'), + 'Partitions', + 'user_login', + 'Cookies' + ); if (fs.existsSync(cookiesPath)) { const stats = fs.statSync(cookiesPath); - console.log('[ELECTRON BROWSER] Cookies file size after flush:', stats.size, 'bytes'); + console.log( + '[ELECTRON BROWSER] Cookies file size after flush:', + stats.size, + 'bytes' + ); } else { - console.log('[ELECTRON BROWSER] WARNING: Cookies file does not exist after flush!'); + console.log( + '[ELECTRON BROWSER] WARNING: Cookies file does not exist after flush!' + ); } } catch (error) { console.error('[ELECTRON BROWSER] Failed to flush storage data:', error); @@ -368,9 +400,14 @@ app.on('before-quit', async (event) => { // Log cookies before flush const cookiesBeforeQuit = await userLoginSession.cookies.get({}); - console.log('[ELECTRON BROWSER] Cookies count before quit:', cookiesBeforeQuit.length); + console.log( + '[ELECTRON BROWSER] Cookies count before quit:', + cookiesBeforeQuit.length + ); if (cookiesBeforeQuit.length > 0) { - console.log('[ELECTRON BROWSER] Cookie domains before quit:', [...new Set(cookiesBeforeQuit.map(c => c.domain))]); + console.log('[ELECTRON BROWSER] Cookie domains before quit:', [ + ...new Set(cookiesBeforeQuit.map((c) => c.domain)), + ]); } // Flush storage diff --git a/backend/app/model/model_platform.py b/backend/app/model/model_platform.py index 707d2b30c..c00d7b7d1 100644 --- a/backend/app/model/model_platform.py +++ b/backend/app/model/model_platform.py @@ -20,6 +20,7 @@ PLATFORM_ALIAS_MAPPING: Final[dict[str, str]] = { "z.ai": "openai-compatible-model", "ModelArk": "openai-compatible-model", "grok": "openai-compatible-model", + "ernie": "openai-compatible-model", "llama.cpp": "openai-compatible-model", } diff --git a/backend/tests/app/model/test_model_platform.py b/backend/tests/app/model/test_model_platform.py index f4ffd1414..64b2e9436 100644 --- a/backend/tests/app/model/test_model_platform.py +++ b/backend/tests/app/model/test_model_platform.py @@ -26,6 +26,7 @@ def test_normalize_model_platform_maps_known_aliases(): assert normalize_model_platform("grok") == "openai-compatible-model" assert normalize_model_platform("z.ai") == "openai-compatible-model" assert normalize_model_platform("ModelArk") == "openai-compatible-model" + assert normalize_model_platform("ernie") == "openai-compatible-model" assert normalize_model_platform("llama.cpp") == "openai-compatible-model" @@ -44,7 +45,7 @@ def test_normalized_model_platform_type_applies_in_pydantic_model(): optional_model_platform: NormalizedOptionalModelPlatform = None item = _Model( - model_platform="llama.cpp", + model_platform="ernie", optional_model_platform="ModelArk", ) diff --git a/src/assets/model/ernie.png b/src/assets/model/ernie.png new file mode 100644 index 000000000..f1007afcf Binary files /dev/null and b/src/assets/model/ernie.png differ diff --git a/src/lib/llm.ts b/src/lib/llm.ts index 6072a5d95..65f4340e6 100644 --- a/src/lib/llm.ts +++ b/src/lib/llm.ts @@ -164,6 +164,15 @@ export const INIT_PROVODERS: Provider[] = [ is_valid: false, model_type: '', }, + { + id: 'ernie', + name: 'Ernie', + apiKey: '', + apiHost: 'https://qianfan.baidubce.com/v2', + description: 'Baidu Ernie model configuration.', + is_valid: false, + model_type: '', + }, { id: 'openai-compatible-model', name: 'OpenAI Compatible', diff --git a/src/pages/Agents/Models.tsx b/src/pages/Agents/Models.tsx index b7b4b86cd..6e5c3ca1b 100644 --- a/src/pages/Agents/Models.tsx +++ b/src/pages/Agents/Models.tsx @@ -64,6 +64,7 @@ import azureImage from '@/assets/model/azure.svg'; import bedrockImage from '@/assets/model/bedrock.svg'; import deepseekImage from '@/assets/model/deepseek.svg'; import eigentImage from '@/assets/model/eigent.svg'; +import ernieImage from '@/assets/model/ernie.png'; import geminiImage from '@/assets/model/gemini.svg'; import llamaCppImage from '@/assets/model/llamacpp.svg'; import lmstudioImage from '@/assets/model/lmstudio.svg'; @@ -1057,6 +1058,7 @@ export default function SettingModels() { openrouter: openrouterImage, 'tongyi-qianwen': qwenImage, deepseek: deepseekImage, + ernie: ernieImage, minimax: minimaxImage, 'z.ai': zaiImage, moonshot: moonshotImage,