feat: новая функция
This commit is contained in:
@@ -141,12 +141,6 @@
|
||||
2024-2025. Все права защищены.
|
||||
</p>
|
||||
<div class="copyright-links">
|
||||
<a href="mailto:info@hb3-accelerator.com" class="copyright-link" title="Связаться с автором">
|
||||
Контакты
|
||||
</a>
|
||||
<a href="https://hb3-accelerator.com" target="_blank" class="copyright-link" title="Официальный сайт">
|
||||
Сайт
|
||||
</a>
|
||||
<a href="https://github.com/HB3-ACCELERATOR" target="_blank" class="copyright-link" title="GitHub">
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
@@ -141,12 +141,32 @@ const loadDbSettings = async () => {
|
||||
|
||||
const checkEncryptionKey = async () => {
|
||||
try {
|
||||
const res = await api.get('/settings/encryption-key/status');
|
||||
console.log('Encryption key status response:', res.data);
|
||||
encryptionKeyState.exists = res.data.exists;
|
||||
encryptionKeyState.key = res.data.key; // Сохраняем ключ из API
|
||||
// Сначала проверяем статус
|
||||
const statusRes = await api.get('/settings/encryption-key/status');
|
||||
console.log('Encryption key status response:', statusRes.data);
|
||||
encryptionKeyState.exists = statusRes.data.exists;
|
||||
console.log('encryptionKeyState.exists updated to:', encryptionKeyState.exists);
|
||||
console.log('encryptionKeyState.key updated to:', encryptionKeyState.key);
|
||||
|
||||
// Если ключ существует, загружаем его содержимое
|
||||
if (encryptionKeyState.exists) {
|
||||
try {
|
||||
const keyRes = await api.get('/settings/encryption-key');
|
||||
console.log('Encryption key response:', keyRes.data);
|
||||
if (keyRes.data.success && keyRes.data.key) {
|
||||
encryptionKeyState.key = keyRes.data.key;
|
||||
console.log('encryptionKeyState.key loaded');
|
||||
} else {
|
||||
encryptionKeyState.key = null;
|
||||
console.log('Key not returned in response');
|
||||
}
|
||||
} catch (keyError) {
|
||||
console.error('Ошибка загрузки ключа шифрования:', keyError);
|
||||
encryptionKeyState.key = null;
|
||||
}
|
||||
} else {
|
||||
encryptionKeyState.key = null;
|
||||
}
|
||||
|
||||
console.log('encryptionKeyState.exists type:', typeof encryptionKeyState.exists);
|
||||
console.log('encryptionKeyState.exists === true:', encryptionKeyState.exists === true);
|
||||
|
||||
|
||||
@@ -95,9 +95,27 @@ async function loadSettings() {
|
||||
}
|
||||
} else {
|
||||
hasSettings.value = false;
|
||||
// Для провайдеров без API ключа (например, Ollama) устанавливаем base URL по умолчанию
|
||||
if (props.provider === 'ollama') {
|
||||
await loadDefaultBaseUrl();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
hasSettings.value = false;
|
||||
// Для провайдеров без API ключа (например, Ollama) устанавливаем base URL по умолчанию
|
||||
if (props.provider === 'ollama') {
|
||||
await loadDefaultBaseUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDefaultBaseUrl() {
|
||||
try {
|
||||
const { data } = await axios.get('/ollama/default-base-url');
|
||||
baseUrl.value = data.baseUrl || props.baseUrlPlaceholder || '';
|
||||
} catch (e) {
|
||||
console.error('Error loading default base URL:', e);
|
||||
baseUrl.value = props.baseUrlPlaceholder || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user