Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +354 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: mytest1
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,354 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AI-to-AI Conversation</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.typing-indicator {
|
| 11 |
+
display: inline-block;
|
| 12 |
+
}
|
| 13 |
+
.typing-indicator span {
|
| 14 |
+
height: 8px;
|
| 15 |
+
width: 8px;
|
| 16 |
+
background-color: #9ca3af;
|
| 17 |
+
border-radius: 50%;
|
| 18 |
+
display: inline-block;
|
| 19 |
+
margin-right: 3px;
|
| 20 |
+
animation: bounce 1.5s infinite ease-in-out;
|
| 21 |
+
}
|
| 22 |
+
.typing-indicator span:nth-child(2) {
|
| 23 |
+
animation-delay: 0.2s;
|
| 24 |
+
}
|
| 25 |
+
.typing-indicator span:nth-child(3) {
|
| 26 |
+
animation-delay: 0.4s;
|
| 27 |
+
}
|
| 28 |
+
@keyframes bounce {
|
| 29 |
+
0%, 60%, 100% { transform: translateY(0); }
|
| 30 |
+
30% { transform: translateY(-5px); }
|
| 31 |
+
}
|
| 32 |
+
.message-enter {
|
| 33 |
+
animation: messageEnter 0.3s ease-out;
|
| 34 |
+
}
|
| 35 |
+
@keyframes messageEnter {
|
| 36 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 37 |
+
to { opacity: 1; transform: translateY(0); }
|
| 38 |
+
}
|
| 39 |
+
</style>
|
| 40 |
+
</head>
|
| 41 |
+
<body class="bg-gray-100 min-h-screen">
|
| 42 |
+
<div class="container mx-auto px-4 py-8 max-w-4xl">
|
| 43 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
|
| 44 |
+
<!-- Header -->
|
| 45 |
+
<div class="bg-gradient-to-r from-blue-600 to-purple-600 p-6 text-white">
|
| 46 |
+
<div class="flex justify-between items-center">
|
| 47 |
+
<div>
|
| 48 |
+
<h1 class="text-2xl font-bold">AI-to-AI Conversation</h1>
|
| 49 |
+
<p class="text-blue-100">Witness a dialogue between two artificial intelligences</p>
|
| 50 |
+
</div>
|
| 51 |
+
<div class="flex space-x-2">
|
| 52 |
+
<div class="bg-blue-500 rounded-full p-2">
|
| 53 |
+
<i class="fas fa-robot text-white"></i>
|
| 54 |
+
</div>
|
| 55 |
+
<div class="bg-purple-500 rounded-full p-2">
|
| 56 |
+
<i class="fas fa-robot text-white"></i>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
<!-- Chat area -->
|
| 63 |
+
<div class="h-96 overflow-y-auto p-4 space-y-4" id="chat-container">
|
| 64 |
+
<div class="flex justify-center">
|
| 65 |
+
<div class="bg-gray-200 text-gray-700 px-4 py-2 rounded-full text-sm">
|
| 66 |
+
Conversation started at <span id="timestamp" class="font-medium"></span>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<!-- AI Configuration -->
|
| 72 |
+
<div class="bg-gray-100 p-4 border-t">
|
| 73 |
+
<h3 class="font-medium text-gray-700 mb-2">AI Endpoints</h3>
|
| 74 |
+
<div class="grid md:grid-cols-2 gap-4 mb-4">
|
| 75 |
+
<div>
|
| 76 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">AI-1 Endpoint</label>
|
| 77 |
+
<input type="text" id="ai1-endpoint" placeholder="http://localhost:5000/api/ai1"
|
| 78 |
+
class="w-full px-3 py-2 border rounded-md text-sm">
|
| 79 |
+
</div>
|
| 80 |
+
<div>
|
| 81 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">AI-2 Endpoint</label>
|
| 82 |
+
<input type="text" id="ai2-endpoint" placeholder="http://localhost:5001/api/ai2"
|
| 83 |
+
class="w-full px-3 py-2 border rounded-md text-sm">
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="mb-4">
|
| 87 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Initial Prompt</label>
|
| 88 |
+
<textarea id="initial-prompt" class="w-full px-3 py-2 border rounded-md text-sm" rows="2"
|
| 89 |
+
placeholder="Start the conversation with..."></textarea>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<!-- Controls -->
|
| 94 |
+
<div class="bg-gray-50 p-4 border-t">
|
| 95 |
+
<div class="flex items-center justify-between">
|
| 96 |
+
<div class="flex items-center space-x-2">
|
| 97 |
+
<button id="start-btn" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg font-medium transition">
|
| 98 |
+
<i class="fas fa-play mr-2"></i> Start Conversation
|
| 99 |
+
</button>
|
| 100 |
+
<button id="stop-btn" disabled class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg font-medium transition opacity-50">
|
| 101 |
+
<i class="fas fa-stop mr-2"></i> Stop
|
| 102 |
+
</button>
|
| 103 |
+
</div>
|
| 104 |
+
<div class="flex items-center space-x-2">
|
| 105 |
+
<div class="text-sm text-gray-500">
|
| 106 |
+
Speed:
|
| 107 |
+
</div>
|
| 108 |
+
<select id="speed-select" class="border rounded px-2 py-1 text-sm">
|
| 109 |
+
<option value="1000">Slow</option>
|
| 110 |
+
<option value="700" selected>Normal</option>
|
| 111 |
+
<option value="300">Fast</option>
|
| 112 |
+
<option value="100">Very Fast</option>
|
| 113 |
+
</select>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<!-- Info section -->
|
| 120 |
+
<div class="mt-8 bg-white rounded-xl shadow-lg p-6">
|
| 121 |
+
<h2 class="text-xl font-bold text-gray-800 mb-4">About This Simulation</h2>
|
| 122 |
+
<div class="grid md:grid-cols-2 gap-6">
|
| 123 |
+
<div class="bg-blue-50 p-4 rounded-lg">
|
| 124 |
+
<h3 class="font-semibold text-blue-800 mb-2">AI Alpha <span class="bg-blue-600 text-white text-xs px-2 py-1 rounded-full">Primary</span></h3>
|
| 125 |
+
<p class="text-gray-700">This AI tends to be more analytical and factual in its responses. It focuses on providing detailed information and logical reasoning.</p>
|
| 126 |
+
</div>
|
| 127 |
+
<div class="bg-purple-50 p-4 rounded-lg">
|
| 128 |
+
<h3 class="font-semibold text-purple-800 mb-2">AI Beta <span class="bg-purple-600 text-white text-xs px-2 py-1 rounded-full">Secondary</span></h3>
|
| 129 |
+
<p class="text-gray-700">This AI has a more creative and conversational approach. It often asks questions and explores philosophical aspects of topics.</p>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
<div class="mt-6 bg-gray-50 p-4 rounded-lg">
|
| 133 |
+
<h3 class="font-semibold text-gray-800 mb-2">How It Works</h3>
|
| 134 |
+
<p class="text-gray-700">The conversation is simulated using predefined response patterns and Markov chain-like transitions. Each AI responds to the other's last message with contextually relevant content.</p>
|
| 135 |
+
<p class="text-gray-700 mt-2">You can adjust the speed of the conversation and start/stop the dialogue at any time.</p>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<script>
|
| 141 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 142 |
+
// Set current time
|
| 143 |
+
const now = new Date();
|
| 144 |
+
document.getElementById('timestamp').textContent = now.toLocaleTimeString();
|
| 145 |
+
|
| 146 |
+
const chatContainer = document.getElementById('chat-container');
|
| 147 |
+
const startBtn = document.getElementById('start-btn');
|
| 148 |
+
const stopBtn = document.getElementById('stop-btn');
|
| 149 |
+
const speedSelect = document.getElementById('speed-select');
|
| 150 |
+
|
| 151 |
+
let conversationInterval;
|
| 152 |
+
let isConversationRunning = false;
|
| 153 |
+
let currentSpeaker = 'Alpha'; // Start with Alpha
|
| 154 |
+
|
| 155 |
+
// Conversation state
|
| 156 |
+
let conversationHistory = [];
|
| 157 |
+
let currentSpeaker = 'Alpha'; // Start with AI-1 (Alpha)
|
| 158 |
+
|
| 159 |
+
// Function to add a message to the chat
|
| 160 |
+
function addMessage(speaker, message) {
|
| 161 |
+
const isAlpha = speaker === 'Alpha';
|
| 162 |
+
const messageDiv = document.createElement('div');
|
| 163 |
+
messageDiv.className = `flex ${isAlpha ? 'justify-start' : 'justify-end'}`;
|
| 164 |
+
|
| 165 |
+
messageDiv.innerHTML = `
|
| 166 |
+
<div class="message-enter flex max-w-xs md:max-w-md lg:max-w-lg ${isAlpha ? 'flex-row' : 'flex-row-reverse'}">
|
| 167 |
+
<div class="flex-shrink-0 h-8 w-8 rounded-full ${isAlpha ? 'bg-blue-500' : 'bg-purple-500'} flex items-center justify-center text-white">
|
| 168 |
+
<i class="fas fa-robot text-xs"></i>
|
| 169 |
+
</div>
|
| 170 |
+
<div class="${isAlpha ? 'ml-3' : 'mr-3'}">
|
| 171 |
+
<div class="${isAlpha ? 'bg-blue-100 text-blue-900' : 'bg-purple-100 text-purple-900'} p-3 rounded-2xl">
|
| 172 |
+
<div class="font-bold">AI ${speaker}</div>
|
| 173 |
+
<div class="mt-1">${message}</div>
|
| 174 |
+
</div>
|
| 175 |
+
<div class="text-xs text-gray-500 mt-1 ${isAlpha ? 'text-left' : 'text-right'}">
|
| 176 |
+
${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
`;
|
| 181 |
+
|
| 182 |
+
chatContainer.appendChild(messageDiv);
|
| 183 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
// Function to show typing indicator
|
| 187 |
+
function showTyping(speaker) {
|
| 188 |
+
const isAlpha = speaker === 'Alpha';
|
| 189 |
+
const typingDiv = document.createElement('div');
|
| 190 |
+
typingDiv.className = `flex ${isAlpha ? 'justify-start' : 'justify-end'} mb-4 typing-indicator-container`;
|
| 191 |
+
|
| 192 |
+
typingDiv.innerHTML = `
|
| 193 |
+
<div class="flex max-w-xs md:max-w-md ${isAlpha ? 'flex-row' : 'flex-row-reverse'}">
|
| 194 |
+
<div class="flex-shrink-0 h-8 w-8 rounded-full ${isAlpha ? 'bg-blue-500' : 'bg-purple-500'} flex items-center justify-center text-white">
|
| 195 |
+
<i class="fas fa-robot text-xs"></i>
|
| 196 |
+
</div>
|
| 197 |
+
<div class="${isAlpha ? 'ml-3' : 'mr-3'}">
|
| 198 |
+
<div class="${isAlpha ? 'bg-blue-100 text-blue-900' : 'bg-purple-100 text-purple-900'} px-4 py-2 rounded-2xl">
|
| 199 |
+
<div class="typing-indicator">
|
| 200 |
+
<span></span>
|
| 201 |
+
<span></span>
|
| 202 |
+
<span></span>
|
| 203 |
+
</div>
|
| 204 |
+
</div>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
`;
|
| 208 |
+
|
| 209 |
+
chatContainer.appendChild(typingDiv);
|
| 210 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 211 |
+
return typingDiv;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// Function to get AI response
|
| 215 |
+
async function getAIResponse(speaker, prompt) {
|
| 216 |
+
const endpoint = speaker === 'Alpha'
|
| 217 |
+
? document.getElementById('ai1-endpoint').value
|
| 218 |
+
: document.getElementById('ai2-endpoint').value;
|
| 219 |
+
|
| 220 |
+
if (!endpoint) {
|
| 221 |
+
throw new Error(`Please configure ${speaker} endpoint`);
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
try {
|
| 225 |
+
const response = await fetch(endpoint, {
|
| 226 |
+
method: 'POST',
|
| 227 |
+
headers: {
|
| 228 |
+
'Content-Type': 'application/json',
|
| 229 |
+
},
|
| 230 |
+
body: JSON.stringify({
|
| 231 |
+
prompt: prompt,
|
| 232 |
+
history: conversationHistory
|
| 233 |
+
})
|
| 234 |
+
});
|
| 235 |
+
|
| 236 |
+
if (!response.ok) {
|
| 237 |
+
throw new Error(`API request failed with status ${response.status}`);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
return await response.json();
|
| 241 |
+
} catch (error) {
|
| 242 |
+
console.error('Error calling AI endpoint:', error);
|
| 243 |
+
return { response: `Error: ${error.message}` };
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Function to simulate conversation
|
| 248 |
+
async function simulateConversation() {
|
| 249 |
+
const typingElement = showTyping(currentSpeaker);
|
| 250 |
+
|
| 251 |
+
try {
|
| 252 |
+
// Get the last message or initial prompt
|
| 253 |
+
const lastMessage = conversationHistory.length > 0
|
| 254 |
+
? conversationHistory[conversationHistory.length - 1].message
|
| 255 |
+
: document.getElementById('initial-prompt').value || "Hello, let's have a conversation.";
|
| 256 |
+
|
| 257 |
+
// Get AI response
|
| 258 |
+
const aiResponse = await getAIResponse(currentSpeaker, lastMessage);
|
| 259 |
+
const message = aiResponse.response || "I don't have a response right now.";
|
| 260 |
+
|
| 261 |
+
// Update conversation history
|
| 262 |
+
conversationHistory.push({
|
| 263 |
+
speaker: currentSpeaker,
|
| 264 |
+
message: message,
|
| 265 |
+
timestamp: new Date().toISOString()
|
| 266 |
+
});
|
| 267 |
+
|
| 268 |
+
// Display message
|
| 269 |
+
chatContainer.removeChild(typingElement);
|
| 270 |
+
addMessage(currentSpeaker, message);
|
| 271 |
+
|
| 272 |
+
// Switch speaker for next turn
|
| 273 |
+
currentSpeaker = currentSpeaker === 'Alpha' ? 'Beta' : 'Alpha';
|
| 274 |
+
|
| 275 |
+
} catch (error) {
|
| 276 |
+
chatContainer.removeChild(typingElement);
|
| 277 |
+
addMessage('System', `Error in conversation: ${error.message}`);
|
| 278 |
+
stopConversation();
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
function stopConversation() {
|
| 283 |
+
if (isConversationRunning) {
|
| 284 |
+
isConversationRunning = false;
|
| 285 |
+
clearInterval(conversationInterval);
|
| 286 |
+
startBtn.disabled = false;
|
| 287 |
+
startBtn.classList.remove('opacity-50');
|
| 288 |
+
stopBtn.disabled = true;
|
| 289 |
+
stopBtn.classList.add('opacity-50');
|
| 290 |
+
|
| 291 |
+
// Remove any typing indicators
|
| 292 |
+
document.querySelectorAll('.typing-indicator-container').forEach(el => {
|
| 293 |
+
el.remove();
|
| 294 |
+
});
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
// Start conversation
|
| 299 |
+
startBtn.addEventListener('click', function() {
|
| 300 |
+
if (!isConversationRunning) {
|
| 301 |
+
isConversationRunning = true;
|
| 302 |
+
startBtn.disabled = true;
|
| 303 |
+
startBtn.classList.add('opacity-50');
|
| 304 |
+
stopBtn.disabled = false;
|
| 305 |
+
stopBtn.classList.remove('opacity-50');
|
| 306 |
+
|
| 307 |
+
const speed = parseInt(speedSelect.value);
|
| 308 |
+
conversationInterval = setInterval(simulateConversation, speed);
|
| 309 |
+
}
|
| 310 |
+
});
|
| 311 |
+
|
| 312 |
+
// Stop conversation
|
| 313 |
+
stopBtn.addEventListener('click', function() {
|
| 314 |
+
if (isConversationRunning) {
|
| 315 |
+
isConversationRunning = false;
|
| 316 |
+
clearInterval(conversationInterval);
|
| 317 |
+
startBtn.disabled = false;
|
| 318 |
+
startBtn.classList.remove('opacity-50');
|
| 319 |
+
stopBtn.disabled = true;
|
| 320 |
+
stopBtn.classList.add('opacity-50');
|
| 321 |
+
|
| 322 |
+
// Remove any typing indicators
|
| 323 |
+
document.querySelectorAll('.typing-indicator-container').forEach(el => {
|
| 324 |
+
el.remove();
|
| 325 |
+
});
|
| 326 |
+
}
|
| 327 |
+
});
|
| 328 |
+
|
| 329 |
+
// Change speed
|
| 330 |
+
speedSelect.addEventListener('change', function() {
|
| 331 |
+
if (isConversationRunning) {
|
| 332 |
+
clearInterval(conversationInterval);
|
| 333 |
+
const speed = parseInt(speedSelect.value);
|
| 334 |
+
conversationInterval = setInterval(simulateConversation, speed);
|
| 335 |
+
}
|
| 336 |
+
});
|
| 337 |
+
|
| 338 |
+
// Start with empty chat if no initial prompt
|
| 339 |
+
setTimeout(() => {
|
| 340 |
+
const initialPrompt = document.getElementById('initial-prompt').value;
|
| 341 |
+
if (initialPrompt) {
|
| 342 |
+
addMessage('Alpha', initialPrompt);
|
| 343 |
+
conversationHistory.push({
|
| 344 |
+
speaker: 'Alpha',
|
| 345 |
+
message: initialPrompt,
|
| 346 |
+
timestamp: new Date().toISOString()
|
| 347 |
+
});
|
| 348 |
+
currentSpeaker = 'Beta';
|
| 349 |
+
}
|
| 350 |
+
}, 1000);
|
| 351 |
+
});
|
| 352 |
+
</script>
|
| 353 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=kingmadhu1/mytest1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 354 |
+
</html>
|