Spaces:
Sleeping
Sleeping
Your Name
commited on
Commit
·
8ffdb31
1
Parent(s):
730dd68
Update frontend to use DeepSeek instead of Gemini
Browse files- static/js/script.js +7 -7
- templates/error.html +4 -4
- templates/index.html +1 -1
static/js/script.js
CHANGED
|
@@ -87,14 +87,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 87 |
.then(response => response.json())
|
| 88 |
.then(data => {
|
| 89 |
if (data.status === 'ok') {
|
| 90 |
-
if (data.
|
| 91 |
-
showStatusMessage('
|
| 92 |
return;
|
| 93 |
}
|
| 94 |
-
if (data.
|
| 95 |
-
showStatusMessage('Connected to
|
| 96 |
} else {
|
| 97 |
-
showStatusMessage('Warning:
|
| 98 |
}
|
| 99 |
} else {
|
| 100 |
showStatusMessage('Server health check failed', true);
|
|
@@ -168,7 +168,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 168 |
.then(response => response.json())
|
| 169 |
.then(data => {
|
| 170 |
if (!data.available) {
|
| 171 |
-
if (data.status === '
|
| 172 |
const errorPath = data.error_page || '/error';
|
| 173 |
window.location.href = `${API_BASE_URL}${errorPath}`;
|
| 174 |
return;
|
|
@@ -327,7 +327,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 327 |
fetch(buildApiUrl('/api/is_initialized'))
|
| 328 |
.then(response => response.json())
|
| 329 |
.then(data => {
|
| 330 |
-
if (data.
|
| 331 |
const errorPath = data.error_page || '/error';
|
| 332 |
window.location.href = `${API_BASE_URL}${errorPath}`;
|
| 333 |
return;
|
|
|
|
| 87 |
.then(response => response.json())
|
| 88 |
.then(data => {
|
| 89 |
if (data.status === 'ok') {
|
| 90 |
+
if (data.missing_deepseek_key) {
|
| 91 |
+
showStatusMessage('DEEPSEEK_API_KEY missing. Chat will remain unavailable until it is configured.', true);
|
| 92 |
return;
|
| 93 |
}
|
| 94 |
+
if (data.deepseek_available) {
|
| 95 |
+
showStatusMessage('Connected to DeepSeek API', false);
|
| 96 |
} else {
|
| 97 |
+
showStatusMessage('Warning: DeepSeek API not available. Using fallback responses.', true);
|
| 98 |
}
|
| 99 |
} else {
|
| 100 |
showStatusMessage('Server health check failed', true);
|
|
|
|
| 168 |
.then(response => response.json())
|
| 169 |
.then(data => {
|
| 170 |
if (!data.available) {
|
| 171 |
+
if (data.status === 'missing_deepseek_key') {
|
| 172 |
const errorPath = data.error_page || '/error';
|
| 173 |
window.location.href = `${API_BASE_URL}${errorPath}`;
|
| 174 |
return;
|
|
|
|
| 327 |
fetch(buildApiUrl('/api/is_initialized'))
|
| 328 |
.then(response => response.json())
|
| 329 |
.then(data => {
|
| 330 |
+
if (data.missing_deepseek_key) {
|
| 331 |
const errorPath = data.error_page || '/error';
|
| 332 |
window.location.href = `${API_BASE_URL}${errorPath}`;
|
| 333 |
return;
|
templates/error.html
CHANGED
|
@@ -69,8 +69,8 @@
|
|
| 69 |
<body>
|
| 70 |
<div class="error-card">
|
| 71 |
<h1>Galatea AI is Unavailable</h1>
|
| 72 |
-
{% if
|
| 73 |
-
<p>We couldn't find a <code>
|
| 74 |
<p>Please add the key and reload the page to continue.</p>
|
| 75 |
|
| 76 |
<div class="steps">
|
|
@@ -78,14 +78,14 @@
|
|
| 78 |
<p><strong>Local setup:</strong></p>
|
| 79 |
<ol>
|
| 80 |
<li>Create a <code>.env</code> file if it doesn't exist.</li>
|
| 81 |
-
<li>Add <code>
|
| 82 |
<li>Restart the Flask app.</li>
|
| 83 |
</ol>
|
| 84 |
|
| 85 |
<p><strong>Hugging Face Spaces:</strong></p>
|
| 86 |
<ol>
|
| 87 |
<li>Open the Space settings and go to <em>Repository secrets</em>.</li>
|
| 88 |
-
<li>Add a secret named <code>
|
| 89 |
<li>Restart or reload the Space.</li>
|
| 90 |
</ol>
|
| 91 |
</div>
|
|
|
|
| 69 |
<body>
|
| 70 |
<div class="error-card">
|
| 71 |
<h1>Galatea AI is Unavailable</h1>
|
| 72 |
+
{% if missing_deepseek_key %}
|
| 73 |
+
<p>We couldn't find a <code>DEEPSEEK_API_KEY</code> in the current environment.</p>
|
| 74 |
<p>Please add the key and reload the page to continue.</p>
|
| 75 |
|
| 76 |
<div class="steps">
|
|
|
|
| 78 |
<p><strong>Local setup:</strong></p>
|
| 79 |
<ol>
|
| 80 |
<li>Create a <code>.env</code> file if it doesn't exist.</li>
|
| 81 |
+
<li>Add <code>DEEPSEEK_API_KEY=<your_key_here></code> to the file.</li>
|
| 82 |
<li>Restart the Flask app.</li>
|
| 83 |
</ol>
|
| 84 |
|
| 85 |
<p><strong>Hugging Face Spaces:</strong></p>
|
| 86 |
<ol>
|
| 87 |
<li>Open the Space settings and go to <em>Repository secrets</em>.</li>
|
| 88 |
+
<li>Add a secret named <code>DEEPSEEK_API_KEY</code> with your DeepSeek API key.</li>
|
| 89 |
<li>Restart or reload the Space.</li>
|
| 90 |
</ol>
|
| 91 |
</div>
|
templates/index.html
CHANGED
|
@@ -21,7 +21,7 @@
|
|
| 21 |
</div>
|
| 22 |
<h2>Initializing Galatea AI</h2>
|
| 23 |
<div class="loading-spinner"></div>
|
| 24 |
-
<p id="loading-status">Waking up and connecting to
|
| 25 |
<div class="loading-bar">
|
| 26 |
<div class="loading-progress" id="loading-progress"></div>
|
| 27 |
</div>
|
|
|
|
| 21 |
</div>
|
| 22 |
<h2>Initializing Galatea AI</h2>
|
| 23 |
<div class="loading-spinner"></div>
|
| 24 |
+
<p id="loading-status">Waking up and connecting to DeepSeek...</p>
|
| 25 |
<div class="loading-bar">
|
| 26 |
<div class="loading-progress" id="loading-progress"></div>
|
| 27 |
</div>
|