Spaces:
Running
Running
🐳 22/02 - 09:19 - Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure element '<URL>'. This request was automatically upgraded to HTTPS, For more information see <URL>
Browse files- chat.html +11 -7
- index.html +8 -7
chat.html
CHANGED
|
@@ -500,8 +500,9 @@ Respond in character. Use *asterisks* for physical actions. Keep responses conci
|
|
| 500 |
if (currentCharacter && char.id === currentCharacter.id) {
|
| 501 |
item.classList.add('active-chat');
|
| 502 |
}
|
|
|
|
| 503 |
item.innerHTML = `
|
| 504 |
-
<img src="${
|
| 505 |
<div class="flex-1 min-w-0">
|
| 506 |
<h4 class="text-sm font-medium text-white truncate">${char.name}</h4>
|
| 507 |
<p class="text-xs text-gray-500 truncate">${char.scene || 'No scenario'}</p>
|
|
@@ -532,10 +533,13 @@ Respond in character. Use *asterisks* for physical actions. Keep responses conci
|
|
| 532 |
});
|
| 533 |
|
| 534 |
// Pre-fill settings with hardcoded OpenRouter key for visibility
|
| 535 |
-
document.getElementById('openaiApiKey')
|
| 536 |
-
|
|
|
|
| 537 |
const apiKeyInput = document.getElementById('apiKey');
|
| 538 |
-
if (apiKeyInput
|
|
|
|
|
|
|
| 539 |
|
| 540 |
// Scenario Modal
|
| 541 |
const scenarioModal = document.getElementById('scenarioModal');
|
|
@@ -664,13 +668,13 @@ Respond in character. Use *asterisks* for physical actions. Keep responses conci
|
|
| 664 |
|
| 665 |
// Simpler fallback - use generic portrait with seed
|
| 666 |
setTimeout(() => {
|
| 667 |
-
|
| 668 |
-
const fallbackUrl = `https://
|
| 669 |
|
| 670 |
const loadingEl2 = document.getElementById(`loading-${loadingId}`);
|
| 671 |
if (loadingEl2) loadingEl2.remove();
|
| 672 |
|
| 673 |
-
addMessage('character', `*${situationDescription.substring(0,
|
| 674 |
}, 1000);
|
| 675 |
}
|
| 676 |
});
|
|
|
|
| 500 |
if (currentCharacter && char.id === currentCharacter.id) {
|
| 501 |
item.classList.add('active-chat');
|
| 502 |
}
|
| 503 |
+
const imgUrl = char.image && char.image.startsWith('http') ? char.image : 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=100&h=100&fit=crop';
|
| 504 |
item.innerHTML = `
|
| 505 |
+
<img src="${imgUrl}" class="w-10 h-10 rounded-full object-cover border border-gray-700">
|
| 506 |
<div class="flex-1 min-w-0">
|
| 507 |
<h4 class="text-sm font-medium text-white truncate">${char.name}</h4>
|
| 508 |
<p class="text-xs text-gray-500 truncate">${char.scene || 'No scenario'}</p>
|
|
|
|
| 533 |
});
|
| 534 |
|
| 535 |
// Pre-fill settings with hardcoded OpenRouter key for visibility
|
| 536 |
+
const openaiKeyInput = document.getElementById('openaiApiKey');
|
| 537 |
+
if (openaiKeyInput) openaiKeyInput.value = OPENROUTER_API_KEY;
|
| 538 |
+
// Remove SinkIn.ai key input if it exists - no longer needed!
|
| 539 |
const apiKeyInput = document.getElementById('apiKey');
|
| 540 |
+
if (apiKeyInput && apiKeyInput.parentElement) {
|
| 541 |
+
apiKeyInput.parentElement.remove();
|
| 542 |
+
}
|
| 543 |
|
| 544 |
// Scenario Modal
|
| 545 |
const scenarioModal = document.getElementById('scenarioModal');
|
|
|
|
| 668 |
|
| 669 |
// Simpler fallback - use generic portrait with seed
|
| 670 |
setTimeout(() => {
|
| 671 |
+
// Use HTTPS placeholder instead of Pollinations for fallback to avoid rate limits
|
| 672 |
+
const fallbackUrl = `https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=512&h=768&fit=crop&seed=${seed}`;
|
| 673 |
|
| 674 |
const loadingEl2 = document.getElementById(`loading-${loadingId}`);
|
| 675 |
if (loadingEl2) loadingEl2.remove();
|
| 676 |
|
| 677 |
+
addMessage('character', `*${situationDescription.substring(0, 40)}...*`, fallbackUrl);
|
| 678 |
}, 1000);
|
| 679 |
}
|
| 680 |
});
|
index.html
CHANGED
|
@@ -276,10 +276,10 @@
|
|
| 276 |
generateText.textContent = 'Generating...';
|
| 277 |
|
| 278 |
try {
|
| 279 |
-
// Build SHORT Pollinations.ai URL - keep under
|
| 280 |
-
const shortAppearance = appearance.substring(0,
|
| 281 |
-
const shortName = name.substring(0,
|
| 282 |
-
const positivePrompt = `portrait of ${shortName}, ${shortAppearance}, detailed,
|
| 283 |
const encodedPrompt = encodeURIComponent(positivePrompt);
|
| 284 |
|
| 285 |
// Pollinations.ai - no API key needed! Short URL for reliability
|
|
@@ -315,10 +315,11 @@
|
|
| 315 |
|
| 316 |
} catch (error) {
|
| 317 |
console.error('Generation error:', error);
|
| 318 |
-
|
|
|
|
| 319 |
|
| 320 |
-
// Fallback to
|
| 321 |
-
const fallbackUrl = `
|
| 322 |
previewImage.src = fallbackUrl;
|
| 323 |
previewImage.dataset.generatedUrl = fallbackUrl;
|
| 324 |
previewImage.dataset.seed = currentSeed;
|
|
|
|
| 276 |
generateText.textContent = 'Generating...';
|
| 277 |
|
| 278 |
try {
|
| 279 |
+
// Build SHORT Pollinations.ai URL - keep under 200 chars total for reliability
|
| 280 |
+
const shortAppearance = appearance.substring(0, 50);
|
| 281 |
+
const shortName = name.substring(0, 15);
|
| 282 |
+
const positivePrompt = `portrait of ${shortName}, ${shortAppearance}, detailed, 8k`.substring(0, 100);
|
| 283 |
const encodedPrompt = encodeURIComponent(positivePrompt);
|
| 284 |
|
| 285 |
// Pollinations.ai - no API key needed! Short URL for reliability
|
|
|
|
| 315 |
|
| 316 |
} catch (error) {
|
| 317 |
console.error('Generation error:', error);
|
| 318 |
+
const errorMsg = error instanceof Error ? error.message : 'Image failed to load';
|
| 319 |
+
generationStatus.textContent = 'Error: ' + errorMsg;
|
| 320 |
|
| 321 |
+
// Fallback to HTTPS placeholder with the same seed
|
| 322 |
+
const fallbackUrl = `https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=640&h=360&fit=crop&seed=${currentSeed}`;
|
| 323 |
previewImage.src = fallbackUrl;
|
| 324 |
previewImage.dataset.generatedUrl = fallbackUrl;
|
| 325 |
previewImage.dataset.seed = currentSeed;
|