@zhongqian97-code/ecode 0.5.26 → 0.5.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6106,6 +6106,9 @@ function generateAdminHtml(version2) {
|
|
|
6106
6106
|
}
|
|
6107
6107
|
} catch (e) {
|
|
6108
6108
|
showToast('\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25: ' + e.message, 'error');
|
|
6109
|
+
if (e.message && e.message.includes('API Key')) {
|
|
6110
|
+
openConfigModal(true);
|
|
6111
|
+
}
|
|
6109
6112
|
}
|
|
6110
6113
|
});
|
|
6111
6114
|
|
|
@@ -6152,7 +6155,7 @@ function generateAdminHtml(version2) {
|
|
|
6152
6155
|
});
|
|
6153
6156
|
|
|
6154
6157
|
// \u2500\u2500 \u914D\u7F6E\u6A21\u6001\u6846 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
6155
|
-
|
|
6158
|
+
async function openConfigModal(focusApiKey) {
|
|
6156
6159
|
try {
|
|
6157
6160
|
const data = await apiFetch('/api/config');
|
|
6158
6161
|
document.getElementById('cfg-model').value = data.model || '';
|
|
@@ -6163,7 +6166,12 @@ function generateAdminHtml(version2) {
|
|
|
6163
6166
|
showToast('\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25: ' + e.message, 'error');
|
|
6164
6167
|
}
|
|
6165
6168
|
document.getElementById('config-modal').classList.add('open');
|
|
6166
|
-
|
|
6169
|
+
if (focusApiKey) {
|
|
6170
|
+
setTimeout(() => document.getElementById('cfg-apikey').focus(), 50);
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6174
|
+
document.getElementById('config-btn').addEventListener('click', () => openConfigModal(false));
|
|
6167
6175
|
|
|
6168
6176
|
document.getElementById('cancel-config').addEventListener('click', () => {
|
|
6169
6177
|
document.getElementById('config-modal').classList.remove('open');
|