()
| 116 | } |
| 117 | |
| 118 | function populateForm() { |
| 119 | const config = state.config; |
| 120 | if (!config) return; |
| 121 | |
| 122 | // Provider |
| 123 | if (config.provider && providerSelect) { |
| 124 | providerSelect.value = config.provider; |
| 125 | } |
| 126 | updateProviderUI(); |
| 127 | |
| 128 | setStatus("", ""); |
| 129 | |
| 130 | // API Key & BaseURL |
| 131 | if (config.hasApiKey && config.apiKey) { |
| 132 | apiKeyInput.value = config.apiKey; |
| 133 | } else if (config.hasApiKey) { |
| 134 | apiKeyInput.value = "***************************************************"; |
| 135 | } else { |
| 136 | apiKeyInput.value = ""; |
| 137 | } |
| 138 | if (baseUrlInput) { |
| 139 | baseUrlInput.value = config.baseUrl || ""; |
| 140 | } |
| 141 | if (modelIdInput) { |
| 142 | modelIdInput.value = config.modelId || ""; |
| 143 | } |
| 144 | if (protocolSelect) { |
| 145 | protocolSelect.value = config.apiProtocol || "openai-completions"; |
| 146 | } |
| 147 | |
| 148 | // OAuth Status |
| 149 | if (config.oauthConnected) { |
| 150 | updateOAuthUI(true); |
| 151 | } else { |
| 152 | updateOAuthUI(false); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | function updateProviderUI() { |
| 157 | if (!providerSelect) return; |
no test coverage detected