()
| 837 | window.importLibraryFromDialog = async function importLibraryFromDialog() { |
| 838 | if (typeof window._importLibraryFromDialogImpl === 'function') { |
| 839 | await window._importLibraryFromDialogImpl(); |
| 840 | } |
| 841 | }; |
| 842 | |
| 843 | // AI Config: Test and Save (early for Docker/server) |
| 844 | const AI_OFFICIAL_CLOUD_HOSTS = ['api.openai.com', 'api.anthropic.com', 'generativelanguage.googleapis.com']; |
| 845 | |
| 846 | function aiApiKeyIsRequired(service, endpoint) { |
| 847 | const s = (service || '').toLowerCase().trim(); |
| 848 | if (s === 'puter' || s === 'custom') return false; |
| 849 | const url = (endpoint || '').trim().toLowerCase(); |
| 850 | if (!url) return s === 'openai' || s === 'claude' || s === 'gemini'; |
| 851 | return AI_OFFICIAL_CLOUD_HOSTS.some((host) => url.indexOf(host) !== -1); |
| 852 | } |
| 853 | |
| 854 | function syncAiApiKeyField(service) { |
| 855 | const apiKeyEl = document.getElementById('ai-api-key'); |
no outgoing calls
no test coverage detected