feat(app.js, i18n): enforce required base URL for Codex API configuration
- Updated the Codex API configuration modals to mark the Base URL field as required. - Added validation to ensure the Base URL is provided before submission, with appropriate error notifications. - Updated internationalization strings to reflect the change in the Base URL label from "Optional" to "Required" in both English and Chinese.
This commit is contained in:
12
app.js
12
app.js
@@ -2961,7 +2961,7 @@ class CLIProxyManager {
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="new-codex-url">${i18n.t('ai_providers.codex_add_modal_url_label')}</label>
|
||||
<input type="text" id="new-codex-url" placeholder="${i18n.t('ai_providers.codex_add_modal_url_placeholder')}">
|
||||
<input type="text" id="new-codex-url" placeholder="${i18n.t('ai_providers.codex_add_modal_url_placeholder')}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="new-codex-proxy">${i18n.t('ai_providers.codex_add_modal_proxy_label')}</label>
|
||||
@@ -2994,6 +2994,10 @@ class CLIProxyManager {
|
||||
this.showNotification(i18n.t('notification.field_required'), 'error');
|
||||
return;
|
||||
}
|
||||
if (!baseUrl) {
|
||||
this.showNotification(i18n.t('notification.codex_base_url_required'), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = await this.makeRequest('/codex-api-key');
|
||||
@@ -3030,7 +3034,7 @@ class CLIProxyManager {
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="edit-codex-url">${i18n.t('ai_providers.codex_edit_modal_url_label')}</label>
|
||||
<input type="text" id="edit-codex-url" value="${config['base-url'] || ''}">
|
||||
<input type="text" id="edit-codex-url" value="${config['base-url'] || ''}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="edit-codex-proxy">${i18n.t('ai_providers.codex_edit_modal_proxy_label')}</label>
|
||||
@@ -3063,6 +3067,10 @@ class CLIProxyManager {
|
||||
this.showNotification(i18n.t('notification.field_required'), 'error');
|
||||
return;
|
||||
}
|
||||
if (!baseUrl) {
|
||||
this.showNotification(i18n.t('notification.codex_base_url_required'), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const listResponse = await this.makeRequest('/codex-api-key');
|
||||
|
||||
Reference in New Issue
Block a user