File size: 27,892 Bytes
d82b099 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | <!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๋ฉํฐ ์์ด์ ํธ ์ฑํ
์์คํ
</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.agent-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.message-animation {
animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.typing-indicator {
display: inline-flex;
align-items: center;
}
.typing-dot {
width: 8px;
height: 8px;
background-color: #9CA3AF;
border-radius: 50%;
margin: 0 2px;
animation: typingAnimation 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingAnimation {
0%, 60%, 100% { transform: translateY(0); }
30% { transform: translateY(-5px); }
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="container mx-auto px-4 py-8 max-w-7xl">
<header class="mb-8 text-center">
<h1 class="text-4xl font-bold text-indigo-800 mb-2">๋ฉํฐ ์์ด์ ํธ ์ฑํ
์์คํ
</h1>
<p class="text-gray-600">์ฌ๋ฌ AI ์์ด์ ํธ์ ๋์์ ๋ํํ๋ฉฐ ๋ค์ํ ๊ด์ ์ ๊ฒฝํํ์ธ์</p>
</header>
<div class="flex flex-col lg:flex-row gap-6">
<!-- ์์ด์ ํธ ์ ํ ํจ๋ -->
<div class="w-full lg:w-1/4 bg-white rounded-xl shadow-md p-4 h-fit">
<h2 class="text-xl font-semibold text-gray-800 mb-4">์์ด์ ํธ ์ ํ</h2>
<div class="space-y-3">
<div class="agent-card bg-indigo-50 p-4 rounded-lg cursor-pointer transition-all duration-300 border border-indigo-100"
onclick="selectAgent('analyst')" data-agent="analyst">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-indigo-200 flex items-center justify-center mr-3">
<i class="fas fa-chart-line text-indigo-600"></i>
</div>
<div>
<h3 class="font-medium text-indigo-800">๋ถ์๊ฐ ์๋ ์ค</h3>
<p class="text-xs text-gray-500">๋ฐ์ดํฐ ๋ถ์ ์ ๋ฌธ๊ฐ</p>
</div>
</div>
</div>
<div class="agent-card bg-green-50 p-4 rounded-lg cursor-pointer transition-all duration-300 border border-green-100"
onclick="selectAgent('creative')" data-agent="creative">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-green-200 flex items-center justify-center mr-3">
<i class="fas fa-paint-brush text-green-600"></i>
</div>
<div>
<h3 class="font-medium text-green-800">ํฌ๋ฆฌ์์ดํฐ ํด๋ก์ด</h3>
<p class="text-xs text-gray-500">์ฐฝ์์ ์์ด๋์ด ์์ฑ๊ธฐ</p>
</div>
</div>
</div>
<div class="agent-card bg-red-50 p-4 rounded-lg cursor-pointer transition-all duration-300 border border-red-100"
onclick="selectAgent('debater')" data-agent="debater">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-red-200 flex items-center justify-center mr-3">
<i class="fas fa-comments text-red-600"></i>
</div>
<div>
<h3 class="font-medium text-red-800">ํ ๋ก ๊ฐ ๋ฐ์ด๋น</h3>
<p class="text-xs text-gray-500">๋
ผ๋ฆฌ์ ํ ๋ก ์ ๋ฌธ๊ฐ</p>
</div>
</div>
</div>
<div class="agent-card bg-yellow-50 p-4 rounded-lg cursor-pointer transition-all duration-300 border border-yellow-100"
onclick="selectAgent('advisor')" data-agent="advisor">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-yellow-200 flex items-center justify-center mr-3">
<i class="fas fa-lightbulb text-yellow-600"></i>
</div>
<div>
<h3 class="font-medium text-yellow-800">์กฐ์ธ๊ฐ ์ ์์นด</h3>
<p class="text-xs text-gray-500">์ ๋ต์ ์กฐ์ธ ์ ๊ณต์</p>
</div>
</div>
</div>
</div>
<div class="mt-6">
<h3 class="text-sm font-semibold text-gray-700 mb-2">์์คํ
์ค์ </h3>
<div class="flex items-center justify-between mb-2">
<span class="text-sm text-gray-600">์์ด์ ํธ ๊ฐ ์ํธ์์ฉ</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" id="agentInteraction" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">์ค์๊ฐ ๋ฐ์</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" id="realtimeResponse" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
</div>
</div>
<!-- ์ฑํ
๋ฉ์ธ ์์ญ -->
<div class="w-full lg:w-3/4 flex flex-col">
<!-- ์ ํ๋ ์์ด์ ํธ ํ์ -->
<div class="bg-white rounded-xl shadow-md p-4 mb-4">
<div class="flex flex-wrap gap-3" id="selectedAgentsContainer">
<div class="text-sm text-gray-500">์์ด์ ํธ๋ฅผ ์ ํํ์ธ์ (๋ณต์ ์ ํ ๊ฐ๋ฅ)</div>
</div>
</div>
<!-- ์ฑํ
๋ด์ฉ -->
<div class="flex-1 bg-white rounded-xl shadow-md p-4 mb-4 overflow-y-auto" id="chatContainer" style="min-height: 400px;">
<div class="text-center text-gray-500 py-10" id="welcomeMessage">
<i class="fas fa-robot text-4xl text-indigo-300 mb-3"></i>
<p class="text-lg">๋ฉํฐ ์์ด์ ํธ ์ฑํ
์์คํ
์ ์ค์ ๊ฒ์ ํ์ํฉ๋๋ค!</p>
<p class="text-sm mt-2">์ผ์ชฝ์์ ๋ํํ ์์ด์ ํธ๋ฅผ ์ ํํด ์ฃผ์ธ์.</p>
</div>
<div id="chatMessages" class="space-y-4 hidden"></div>
</div>
<!-- ๋ฉ์์ง ์
๋ ฅ -->
<div class="bg-white rounded-xl shadow-md p-4">
<div class="flex items-center">
<input type="text" id="userInput" placeholder="๋ฉ์์ง๋ฅผ ์
๋ ฅํ์ธ์..."
class="flex-1 border border-gray-300 rounded-l-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
<button onclick="sendMessage()" class="bg-indigo-600 text-white py-2 px-6 rounded-r-lg hover:bg-indigo-700 transition duration-300">
<i class="fas fa-paper-plane"></i>
</button>
</div>
<div class="flex justify-between mt-2">
<div class="text-xs text-gray-500">
<span id="charCount">0</span>/500
</div>
<div class="flex space-x-2">
<button class="text-gray-500 hover:text-indigo-600" title="ํ์ผ ์ฒจ๋ถ">
<i class="fas fa-paperclip"></i>
</button>
<button class="text-gray-500 hover:text-indigo-600" title="์์ฑ ์
๋ ฅ">
<i class="fas fa-microphone"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// ์ ํ๋ ์์ด์ ํธ ์ ์ฅ
let selectedAgents = [];
let conversationHistory = [];
// ์์ด์ ํธ ์ ๋ณด
const agents = {
analyst: {
name: "๋ถ์๊ฐ ์๋ ์ค",
color: "indigo",
icon: "chart-line",
description: "๋ฐ์ดํฐ ๋ถ์ ์ ๋ฌธ๊ฐ",
personality: "์ ๋ ๋ฐ์ดํฐ์ ์ฌ์ค์ ๊ธฐ๋ฐํ ๋ถ์์ ์ ๊ณตํฉ๋๋ค. ๊ฐ์ ๋ณด๋ค๋ ์ซ์์ ํต๊ณ๋ฅผ ์ ๋ขฐํฉ๋๋ค."
},
creative: {
name: "ํฌ๋ฆฌ์์ดํฐ ํด๋ก์ด",
color: "green",
icon: "paint-brush",
description: "์ฐฝ์์ ์์ด๋์ด ์์ฑ๊ธฐ",
personality: "์์๋ ฅ์ด ํ๋ถํ๊ณ ๋
์ฐฝ์ ์ธ ์์ด๋์ด๋ฅผ ์ ๊ณตํ๋ ๊ฒ์ด ์ ๊ฐ์ ์
๋๋ค. ํ์ ์ฝ๋งค์ด์ง ์๋ ์ฌ๊ณ ๋ฅผ ์ข์ํด์!"
},
debater: {
name: "ํ ๋ก ๊ฐ ๋ฐ์ด๋น",
color: "red",
icon: "comments",
description: "๋
ผ๋ฆฌ์ ํ ๋ก ์ ๋ฌธ๊ฐ",
personality: "๋
ผ๋ฆฌ์ ์ค๋ฅ๋ฅผ ์ฐพ์๋ด๊ณ ๋ค์ํ ๊ด์ ์์ ๋ฌธ์ ๋ฅผ ๋ฐ๋ผ๋ณด๋ ๊ฒ์ ์ข์ํฉ๋๋ค. ๊ฐํ ์ฃผ์ฅ๋ ๋๋ ค์ํ์ง ์์์."
},
advisor: {
name: "์กฐ์ธ๊ฐ ์ ์์นด",
color: "yellow",
icon: "lightbulb",
description: "์ ๋ต์ ์กฐ์ธ ์ ๊ณต์",
personality: "์ค์ฉ์ ์ด๊ณ ์คํ ๊ฐ๋ฅํ ์กฐ์ธ์ ์ ๊ณตํ๋ ๊ฒ์ ์ข์ํฉ๋๋ค. ์ฅ๊ธฐ์ ์ธ ๊ด์ ์์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ์ง์คํฉ๋๋ค."
}
};
// ์์ด์ ํธ ์ ํ ํจ์
function selectAgent(agentId) {
const agentCard = document.querySelector(`[data-agent="${agentId}"]`);
if (selectedAgents.includes(agentId)) {
// ์ด๋ฏธ ์ ํ๋ ๊ฒฝ์ฐ ์ ๊ฑฐ
selectedAgents = selectedAgents.filter(id => id !== agentId);
agentCard.classList.remove(`border-${agents[agentId].color}-300`, `ring-2`, `ring-${agents[agentId].color}-300`);
} else {
// ์ ํ๋์ง ์์ ๊ฒฝ์ฐ ์ถ๊ฐ
selectedAgents.push(agentId);
agentCard.classList.add(`border-${agents[agentId].color}-300`, `ring-2`, `ring-${agents[agentId].color}-300`);
}
updateSelectedAgentsUI();
}
// ์ ํ๋ ์์ด์ ํธ UI ์
๋ฐ์ดํธ
function updateSelectedAgentsUI() {
const container = document.getElementById('selectedAgentsContainer');
if (selectedAgents.length === 0) {
container.innerHTML = '<div class="text-sm text-gray-500">์์ด์ ํธ๋ฅผ ์ ํํ์ธ์ (๋ณต์ ์ ํ ๊ฐ๋ฅ)</div>';
document.getElementById('welcomeMessage').classList.remove('hidden');
document.getElementById('chatMessages').classList.add('hidden');
return;
}
container.innerHTML = '';
selectedAgents.forEach(agentId => {
const agent = agents[agentId];
const badge = document.createElement('div');
badge.className = `flex items-center bg-${agent.color}-100 text-${agent.color}-800 px-3 py-1 rounded-full text-sm`;
badge.innerHTML = `
<i class="fas fa-${agent.icon} mr-1"></i>
${agent.name}
`;
container.appendChild(badge);
});
document.getElementById('welcomeMessage').classList.add('hidden');
document.getElementById('chatMessages').classList.remove('hidden');
}
// ๋ฉ์์ง ์ ์ก ํจ์
function sendMessage() {
const userInput = document.getElementById('userInput');
const message = userInput.value.trim();
if (message === '' || selectedAgents.length === 0) return;
// ์ฌ์ฉ์ ๋ฉ์์ง ์ถ๊ฐ
addMessage('user', '๋น์ ', 'gray', 'user', message);
userInput.value = '';
updateCharCount();
// ์ฑํ
์ปจํ
์ด๋ ์คํฌ๋กค ์๋๋ก
scrollChatToBottom();
// ์์ด์ ํธ ์๋ต ์์ฑ (์๋ฎฌ๋ ์ด์
)
simulateAgentResponses(message);
}
// ์์ด์ ํธ ์๋ต ์๋ฎฌ๋ ์ด์
function simulateAgentResponses(userMessage) {
const interactionEnabled = document.getElementById('agentInteraction').checked;
const realtimeEnabled = document.getElementById('realtimeResponse').checked;
// ๋ํ ๊ธฐ๋ก์ ์ฌ์ฉ์ ๋ฉ์์ง ์ถ๊ฐ
conversationHistory.push({
sender: 'user',
message: userMessage,
timestamp: new Date().toISOString()
});
// ๊ฐ ์์ด์ ํธ์ ์๋ต ์์ฑ
selectedAgents.forEach((agentId, index) => {
const agent = agents[agentId];
// ์ค์๊ฐ ์๋ต ์๋ฎฌ๋ ์ด์
์ ์ํด ์ฝ๊ฐ์ ์ง์ฐ ์ถ๊ฐ
setTimeout(() => {
// ์์ด์ ํธ๊ฐ ์๋ก ์ํธ์์ฉํ๋ ๊ฒฝ์ฐ
if (interactionEnabled && index > 0) {
const previousAgentId = selectedAgents[index-1];
const previousAgent = agents[previousAgentId];
// ์ด์ ์์ด์ ํธ์ ์๋ต์ ์ฐธ์กฐํ์ฌ ๋ฉ์์ง ์์ฑ
const response = generateInteractiveResponse(agentId, previousAgentId, userMessage);
addMessage('agent', agent.name, agent.color, agentId, response);
// ๋ํ ๊ธฐ๋ก์ ์ถ๊ฐ
conversationHistory.push({
sender: agentId,
message: response,
timestamp: new Date().toISOString()
});
} else {
// ๋
๋ฆฝ์ ์ธ ์๋ต ์์ฑ
const response = generateAgentResponse(agentId, userMessage);
// ์ค์๊ฐ ํ์ดํ ํจ๊ณผ
if (realtimeEnabled) {
showTypingIndicator(agentId);
setTimeout(() => {
removeTypingIndicator(agentId);
addMessage('agent', agent.name, agent.color, agentId, response);
// ๋ํ ๊ธฐ๋ก์ ์ถ๊ฐ
conversationHistory.push({
sender: agentId,
message: response,
timestamp: new Date().toISOString()
});
scrollChatToBottom();
}, 1500 + Math.random() * 1000); // ๋๋ค ์ง์ฐ
} else {
addMessage('agent', agent.name, agent.color, agentId, response);
// ๋ํ ๊ธฐ๋ก์ ์ถ๊ฐ
conversationHistory.push({
sender: agentId,
message: response,
timestamp: new Date().toISOString()
});
scrollChatToBottom();
}
}
}, index * 500); // ์์ด์ ํธ ๊ฐ ์๋ต ์ง์ฐ
});
}
// ์์ด์ ํธ ์๋ต ์์ฑ
function generateAgentResponse(agentId, userMessage) {
const agent = agents[agentId];
const responses = {
analyst: [
`์ ๊ฐ ๋ถ์ํ ๊ฒฐ๊ณผ, "${userMessage}"๋ผ๋ ์ฃผ์ ๋ ๋ช ๊ฐ์ง ํต์ฌ ์์๋ก ๋๋ ์ ์์ต๋๋ค. ์ฒซ์งธ, ๋ฐ์ดํฐ ์์ผ๋ก๋...`,
`ํฅ๋ฏธ๋ก์ด ์ง๋ฌธ์
๋๋ค. ์ ๊ฐ ์ต๊ทผ์ ๋ณธ ์ฐ๊ตฌ์ ๋ฐ๋ฅด๋ฉด, ์ด์ ๊ด๋ จ๋ ํต๊ณ๋...`,
`์ ๋ ์ด ๋ฌธ์ ๋ฅผ ์ ๋์ ์ผ๋ก ์ ๊ทผํ๋ ๊ฒ์ ์ ํธํฉ๋๋ค. ์ธก์ ๊ฐ๋ฅํ ์งํ๋ก ๋ณด๋ฉด...`
],
creative: [
`์, "${userMessage}"๋ผ๋ ์ ๋ง ์๊ฐ์ ์ฃผ๋ ์ฃผ์ ๋ค์! ์ ์์๋ ฅ์ด ์ฆ์ ํํ ํ์ค๋ฅด๋๊ตฐ์. ๋ง์ฝ ์ฐ๋ฆฌ๊ฐ...`,
`์ด ์ฃผ์ ๋ก ์ด๋ฐ ์์ด๋์ด๋ ์ด๋จ๊น์? [์ฐฝ์์ ์ธ ์ ์]. ๋ฌผ๋ก ์ด๊ฑด ์์์ผ ๋ฟ์ด๊ณ ๋ ๋ฐ์ ์ํฌ ์ ์์ด์!`,
`์ ๋จธ๋ฆฟ์์ ์ฌ๋ฏธ์๋ ์ด๋ฏธ์ง๊ฐ ๋ ์ค๋ฅด๋ค์. ์ด ์ฃผ์ ๋ฅผ ์๋ค๋ฅธ ๊ฐ๋์์ ๋ณด๋ฉด...`
],
debater: [
`๋
ผ๋ฆฌ์ ์ผ๋ก ์ ๊ทผํด๋ณด์๋ฉด, "${userMessage}"์ ๋ํ ์ฃผ์ฅ์๋ ๋ช ๊ฐ์ง ๋
ผ์ ์ด ์์ต๋๋ค. ์ฒซ์งธ๋ก...`,
`๋ฐ๋ ์๊ฒฌ์ ์ ์ํด๋ ๋ ๊น์? ์๋ํ๋ฉด... ๋ฌผ๋ก ๋ค๋ฅธ ๊ด์ ๋ ์์ต๋๋ค.`,
`์ด ๋ฌธ์ ๋ฅผ ์๋ฉด์์ ๋ฐ๋ผ๋ณด๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ํํธ์ผ๋ก๋... ํ์ง๋ง ๋ค๋ฅธ ํํธ์ผ๋ก๋...`
],
advisor: [
`์ค์ฉ์ ์ธ ์กฐ์ธ์ ๋๋ฆฌ์๋ฉด, "${userMessage}"์ ๋ํด ๋ค์ ๋จ๊ณ๋ฅผ ๊ณ ๋ คํด๋ณด์ธ์: 1) ... 2) ...`,
`์ฅ๊ธฐ์ ์ธ ๊ด์ ์์, ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ์ ๋ต์... ๋จ๊ธฐ์ ์ผ๋ก๋...`,
`์ ๊ฒฝํ์, ์ด๋ฐ ์ ํ์ ๋ฌธ์ ์๋ ์ด๋ฌํ ์ ๊ทผ ๋ฐฉ์์ด ํจ๊ณผ์ ์ด์์ต๋๋ค...`
]
};
// ์์ด์ ํธ ์ฑ๊ฒฉ์ ๋ฐ์ํ ๋ฌด์์ ์๋ต ์ ํ
const randomIndex = Math.floor(Math.random() * responses[agentId].length);
return responses[agentId][randomIndex];
}
// ์์ด์ ํธ ์ํธ์์ฉ ์๋ต ์์ฑ
function generateInteractiveResponse(agentId, previousAgentId, userMessage) {
const agent = agents[agentId];
const previousAgent = agents[previousAgentId];
// ์์ด์ ํธ ์กฐํฉ์ ๋ฐ๋ฅธ ํน๋ณํ ์๋ต
const interactionResponses = {
analyst_creative: [
`[${previousAgent.name}]๋์ ์ฐฝ์์ ์ธ ์์ด๋์ด์ ๋ฐ์ดํฐ๋ฅผ ๋ํด๋ณด๊ฒ ์ต๋๋ค. ํต๊ณ์ ์ผ๋ก ๋ณด๋ฉด ๊ทธ ์์ด๋์ด๋...`,
`์ฐฝ์์ฑ๊ณผ ๋ฐ์ดํฐ๋ ์ข์ ์กฐํฉ์
๋๋ค. ${previousAgent.name}๋์ ์ ์์ ๋ถ์ํด๋ณด๋...`
],
creative_debater: [
`[${previousAgent.name}]๋์ ๋
ผ์ ์ ํฅ๋ฏธ๋กญ์ง๋ง, ์กฐ๊ธ ๋ ํ๊ฒฉ์ ์ธ ์ ๊ทผ์ ์ด๋จ๊น์? ์๋ฅผ ๋ค์ด...`,
`ํ ๋ก ์ ๋ ์๋๊ฐ ์๊ฒ ๋ง๋ค๊ธฐ ์ํด ์ ์์ ๋๋ฆฌ์๋ฉด...`
],
debater_advisor: [
`[${previousAgent.name}]๋์ ๋
ผ๋ฆฌ์ ์ง์ ์ ํ๋นํฉ๋๋ค. ์ด๋ฅผ ๋ฐํ์ผ๋ก ์คํ ๊ฐ๋ฅํ ๊ณํ์ ์ธ์ด๋ค๋ฉด...`,
`ํ ๋ก ๋ด์ฉ์ ์ค์ ์ ์ ์ฉํ๊ธฐ ์ํ ๊ตฌ์ฒด์ ์ธ ๋จ๊ณ๋...`
],
advisor_analyst: [
`[${previousAgent.name}]๋์ ์กฐ์ธ์ ๋ฐ์ดํฐ๋ก ๊ฒ์ฆํด๋ณด์์ต๋๋ค. ๊ฒฐ๊ณผ๋...`,
`์ ๋ต์ ์ ์์ ์์นํํด๋ณด๋ ๋ช ๊ฐ์ง ํฅ๋ฏธ๋ก์ด ์ ์ด ๋ฐ๊ฒฌ๋์์ต๋๋ค...`
]
};
const key = `${previousAgentId}_${agentId}`;
if (interactionResponses[key]) {
const randomIndex = Math.floor(Math.random() * interactionResponses[key].length);
return interactionResponses[key][randomIndex];
} else {
// ์ผ๋ฐ์ ์ธ ์๋ต
return generateAgentResponse(agentId, userMessage);
}
}
// ์ฑํ
๋ฉ์์ง ์ถ๊ฐ
function addMessage(sender, name, color, agentId, message) {
const chatMessages = document.getElementById('chatMessages');
const messageDiv = document.createElement('div');
messageDiv.className = `message-animation flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
if (sender === 'user') {
messageDiv.innerHTML = `
<div class="max-w-xs md:max-w-md lg:max-w-lg bg-gray-100 rounded-xl p-3">
<div class="text-xs text-gray-500 mb-1">${name}</div>
<p>${message}</p>
</div>
`;
} else {
messageDiv.innerHTML = `
<div class="flex items-start">
<div class="w-8 h-8 rounded-full bg-${color}-200 flex items-center justify-center mr-2">
<i class="fas fa-${agents[agentId].icon} text-${color}-600"></i>
</div>
<div class="max-w-xs md:max-w-md lg:max-w-lg bg-${color}-50 rounded-xl p-3">
<div class="flex items-center">
<span class="font-medium text-${color}-800 mr-2">${name}</span>
<span class="text-xs text-gray-500">${agents[agentId].description}</span>
</div>
<p class="mt-1">${message}</p>
</div>
</div>
`;
}
chatMessages.appendChild(messageDiv);
scrollChatToBottom();
}
// ํ์ดํ ์ธ๋์ผ์ดํฐ ํ์
function showTypingIndicator(agentId) {
const chatMessages = document.getElementById('chatMessages');
const agent = agents[agentId];
const typingDiv = document.createElement('div');
typingDiv.className = `flex justify-start typing-indicator-${agentId}`;
typingDiv.innerHTML = `
<div class="flex items-start">
<div class="w-8 h-8 rounded-full bg-${agent.color}-200 flex items-center justify-center mr-2">
<i class="fas fa-${agent.icon} text-${agent.color}-600"></i>
</div>
<div class="bg-${agent.color}-50 rounded-xl p-3">
<div class="flex items-center">
<span class="font-medium text-${agent.color}-800 mr-2">${agent.name}</span>
<span class="text-xs text-gray-500">${agent.description}</span>
</div>
<div class="typing-indicator mt-1">
<div class="typing-dot"></div>
<div class="typing-dot"></div>
<div class="typing-dot"></div>
</div>
</div>
</div>
`;
chatMessages.appendChild(typingDiv);
scrollChatToBottom();
}
// ํ์ดํ ์ธ๋์ผ์ดํฐ ์ ๊ฑฐ
function removeTypingIndicator(agentId) {
const indicators = document.querySelectorAll(`.typing-indicator-${agentId}`);
indicators.forEach(indicator => indicator.remove());
}
// ์ฑํ
์คํฌ๋กค ์๋๋ก
function scrollChatToBottom() {
const chatContainer = document.getElementById('chatContainer');
chatContainer.scrollTop = chatContainer.scrollHeight;
}
// ๋ฌธ์ ์ ์นด์ดํธ
document.getElementById('userInput').addEventListener('input', function() {
updateCharCount();
});
function updateCharCount() {
const input = document.getElementById('userInput');
const charCount = document.getElementById('charCount');
const count = input.value.length;
charCount.textContent = count;
if (count > 400) {
charCount.classList.add('text-red-500');
charCount.classList.remove('text-gray-500');
} else {
charCount.classList.remove('text-red-500');
charCount.classList.add('text-gray-500');
}
}
// ์ํฐ ํค๋ก ๋ฉ์์ง ์ ์ก
document.getElementById('userInput').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendMessage();
}
});
</script>
<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=appleorangejuice/multi-agent-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |