Dumoura's picture
Add 2 files
a0c2106 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Persona Dialogue Generator</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.persona-card {
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.persona-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}
.selected-persona {
border: 3px solid #4f46e5;
transform: scale(1.02);
}
.dialogue-bubble {
position: relative;
border-radius: 1.25rem;
padding: 1rem;
margin: 0.5rem 0;
max-width: 80%;
}
.dialogue-bubble::after {
content: '';
position: absolute;
width: 0;
height: 0;
border: 10px solid transparent;
}
.left-bubble {
background-color: #e2e8f0;
align-self: flex-start;
}
.left-bubble::after {
left: -10px;
top: 15px;
border-right-color: #e2e8f0;
border-left: 0;
}
.right-bubble {
background-color: #4f46e5;
color: white;
align-self: flex-end;
}
.right-bubble::after {
right: -10px;
top: 15px;
border-left-color: #4f46e5;
border-right: 0;
}
.typing-indicator {
display: flex;
padding: 8px;
}
.typing-dot {
width: 8px;
height: 8px;
background-color: #9ca3af;
border-radius: 50%;
margin: 0 2px;
animation: typing 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 typing {
0%, 60%, 100% {
transform: translateY(0);
}
30% {
transform: translateY(-5px);
}
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.poem-container {
background: linear-gradient(to right, #f8f9fa, #e9ecef);
border-left: 4px solid #4f46e5;
}
.image-placeholder {
background: linear-gradient(to right, #f3f4f6, #e5e7eb);
display: flex;
align-items: center;
justify-content: center;
color: #6b7280;
}
</style>
</head>
<body class="gradient-bg min-h-screen">
<div class="container mx-auto px-4 py-8">
<header class="text-center mb-12">
<h1 class="text-4xl font-bold text-gray-800 mb-2">AI Persona Dialogue Generator</h1>
<p class="text-xl text-gray-600">Create meaningful conversations between different AI personas</p>
</header>
<!-- Authentication Section -->
<section id="auth-section" class="bg-white rounded-xl shadow-md p-6 mb-8">
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Hugging Face Authentication</h2>
<div class="mb-4">
<label for="hf-token" class="block text-sm font-medium text-gray-700 mb-1">Hugging Face Access Token</label>
<input type="password" id="hf-token" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Enter your Hugging Face token">
<p class="mt-1 text-sm text-gray-500">Your token is used only for this session and is not stored.</p>
</div>
<button id="auth-btn" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 transition duration-200">
Authenticate
</button>
</section>
<!-- Persona Selection Section -->
<section id="persona-section" class="hidden bg-white rounded-xl shadow-md p-6 mb-8">
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Select Two Personas</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<div class="persona-card p-4 rounded-lg border border-gray-200 cursor-pointer" data-persona="philosopher">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
<span class="text-purple-600">Φ</span>
</div>
<h3 class="font-medium text-gray-800">Philosopher</h3>
</div>
<p class="text-sm text-gray-600">Contemplative, profound, questioning existence with structured reasoning.</p>
</div>
<div class="persona-card p-4 rounded-lg border border-gray-200 cursor-pointer" data-persona="poet">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-pink-100 flex items-center justify-center mr-3">
<span class="text-pink-600"></span>
</div>
<h3 class="font-medium text-gray-800">Poet</h3>
</div>
<p class="text-sm text-gray-600">Emotive, lyrical, expressing through vivid imagery and rhythm.</p>
</div>
<div class="persona-card p-4 rounded-lg border border-gray-200 cursor-pointer" data-persona="historian">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-amber-100 flex items-center justify-center mr-3">
<span class="text-amber-600">H</span>
</div>
<h3 class="font-medium text-gray-800">Historian</h3>
</div>
<p class="text-sm text-gray-600">Nostalgic, narrative-driven, connecting past events to present.</p>
</div>
<div class="persona-card p-4 rounded-lg border border-gray-200 cursor-pointer" data-persona="critic">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3">
<span class="text-blue-600">A</span>
</div>
<h3 class="font-medium text-gray-800">Art Critic</h3>
</div>
<p class="text-sm text-gray-600">Analytical yet passionate, interpreting art's deeper meanings.</p>
</div>
<div class="persona-card p-4 rounded-lg border border-gray-200 cursor-pointer" data-persona="kid">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3">
<span class="text-green-600"></span>
</div>
<h3 class="font-medium text-gray-800">Kid</h3>
</div>
<p class="text-sm text-gray-600">Playful, curious, unfiltered perspective with boundless imagination.</p>
</div>
<div class="persona-card p-4 rounded-lg border border-gray-200 cursor-pointer" data-persona="engineer">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-red-100 flex items-center justify-center mr-3">
<span class="text-red-600"></span>
</div>
<h3 class="font-medium text-gray-800">Engineer</h3>
</div>
<p class="text-sm text-gray-600">Precise, methodical, finding beauty in functionality and innovation.</p>
</div>
</div>
<div class="flex flex-col md:flex-row gap-4 mb-6">
<div class="flex-1">
<label class="block text-sm font-medium text-gray-700 mb-1">Persona 1</label>
<select id="persona1-select" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500">
<option value="">Select first persona</option>
<option value="philosopher">Philosopher</option>
<option value="poet">Poet</option>
<option value="historian">Historian</option>
<option value="critic">Art Critic</option>
<option value="kid">Kid</option>
<option value="engineer">Engineer</option>
</select>
</div>
<div class="flex-1">
<label class="block text-sm font-medium text-gray-700 mb-1">Persona 2</label>
<select id="persona2-select" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500">
<option value="">Select second persona</option>
<option value="philosopher">Philosopher</option>
<option value="poet">Poet</option>
<option value="historian">Historian</option>
<option value="critic">Art Critic</option>
<option value="kid">Kid</option>
<option value="engineer">Engineer</option>
</select>
</div>
</div>
<div class="mb-4">
<label for="topic-input" class="block text-sm font-medium text-gray-700 mb-1">Discussion Topic</label>
<input type="text" id="topic-input" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Enter a topic for discussion (e.g., 'the meaning of happiness')">
</div>
<button id="start-dialogue-btn" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 transition duration-200 disabled:opacity-50" disabled>
Start Dialogue
</button>
</section>
<!-- Dialogue Section -->
<section id="dialogue-section" class="hidden bg-white rounded-xl shadow-md p-6 mb-8">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-semibold text-gray-800">AI Dialogue</h2>
<div class="flex items-center">
<span id="persona1-name" class="bg-gray-100 px-3 py-1 rounded-full text-sm font-medium mr-2"></span>
<span id="persona2-name" class="bg-indigo-100 px-3 py-1 rounded-full text-sm font-medium text-indigo-800"></span>
</div>
</div>
<div id="dialogue-container" class="flex flex-col h-96 overflow-y-auto p-4 bg-gray-50 rounded-lg mb-4">
<!-- Dialogue bubbles will appear here -->
<div class="text-center text-gray-500 mt-32">The AI personas will discuss the topic here...</div>
</div>
<div class="flex justify-between">
<button id="pause-dialogue-btn" class="bg-gray-200 text-gray-800 py-2 px-4 rounded-md hover:bg-gray-300 transition duration-200">
Pause
</button>
<button id="next-phase-btn" class="bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 transition duration-200 hidden">
Next Phase
</button>
</div>
</section>
<!-- Refinement Section -->
<section id="refinement-section" class="hidden bg-white rounded-xl shadow-md p-6 mb-8">
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Refined Understanding</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-medium text-gray-800 mb-2">Context</h3>
<div id="context-output" class="text-sm text-gray-600 italic">The shared context will appear here...</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-medium text-gray-800 mb-2">Common Ground</h3>
<div id="common-ground-output" class="text-sm text-gray-600 italic">Areas of agreement will appear here...</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-medium text-gray-800 mb-2">Remaining Differences</h3>
<div id="differences-output" class="text-sm text-gray-600 italic">Points of divergence will appear here...</div>
</div>
</div>
<div class="mb-6">
<h3 class="font-medium text-gray-800 mb-2">Final Poem</h3>
<div id="poem-output" class="poem-container p-4 rounded-lg italic whitespace-pre-line">
The collaboratively generated poem will appear here...
</div>
</div>
<div class="mb-6">
<h3 class="font-medium text-gray-800 mb-2">Visual Interpretation</h3>
<div id="image-output" class="image-placeholder w-full h-64 rounded-lg">
<p>An AI-generated image based on the poem will appear here...</p>
</div>
</div>
<button id="restart-btn" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 transition duration-200">
Start New Dialogue
</button>
</section>
</div>
<script>
// Global variables
let hfToken = '';
let persona1 = '';
let persona2 = '';
let topic = '';
let dialoguePhase = 0;
let isDialoguePaused = false;
let dialogueInterval;
let dialogueHistory = [];
// Persona descriptions
const personas = {
philosopher: {
name: "Philosopher",
description: "The philosopher navigates through the quiet seas of contemplation, embodying reflective serenity and existential wonder. With a mind attuned to life's profound questions, their prose flows like an elegant yet meticulously crafted river, structuring reasoned arguments into clear channels of thought.",
color: "purple"
},
poet: {
name: "Poet",
description: "The poet thrives in a realm of vibrant emotion, their heart resonating with intense sensitivity to both beauty and suffering. Each verse they craft is an emotive tapestry woven with lyrical metaphors, rhythmic cadences, and evocative imagery.",
color: "pink"
},
historian: {
name: "Historian",
description: "The historian walks gently through corridors of the past, imbued with nostalgic curiosity and reverential respect toward lives once lived. They translate historical facts into compelling narratives, interweaving careful scholarship with emotional sensitivity.",
color: "amber"
},
critic: {
name: "Art Critic",
description: "The art critic inhabits a crossroads of passionate enthusiasm and measured intellectual analysis. Their sensitivity to beauty is tempered by critical clarity, resulting in writing that is both analytically rigorous and poetically vivid.",
color: "blue"
},
kid: {
name: "Kid",
description: "Bursting with pure enthusiasm and playful curiosity, the kid embodies emotional honesty and unfiltered wonder. Their language is delightfully spontaneous and imaginative, punctuated by exclamations and bold questions.",
color: "green"
},
engineer: {
name: "Engineer",
description: "Guided by methodical excitement and intellectual satisfaction, the engineer finds deep emotional resonance in precision and functionality. Their textual style is clear, concise, structured, and precise, reflecting a disciplined passion for innovation.",
color: "red"
}
};
// DOM elements
const authSection = document.getElementById('auth-section');
const personaSection = document.getElementById('persona-section');
const dialogueSection = document.getElementById('dialogue-section');
const refinementSection = document.getElementById('refinement-section');
const authBtn = document.getElementById('auth-btn');
const hfTokenInput = document.getElementById('hf-token');
const startDialogueBtn = document.getElementById('start-dialogue-btn');
const pauseDialogueBtn = document.getElementById('pause-dialogue-btn');
const nextPhaseBtn = document.getElementById('next-phase-btn');
const restartBtn = document.getElementById('restart-btn');
const persona1Select = document.getElementById('persona1-select');
const persona2Select = document.getElementById('persona2-select');
const topicInput = document.getElementById('topic-input');
const persona1Name = document.getElementById('persona1-name');
const persona2Name = document.getElementById('persona2-name');
const dialogueContainer = document.getElementById('dialogue-container');
const contextOutput = document.getElementById('context-output');
const commonGroundOutput = document.getElementById('common-ground-output');
const differencesOutput = document.getElementById('differences-output');
const poemOutput = document.getElementById('poem-output');
const imageOutput = document.getElementById('image-output');
// Event listeners
authBtn.addEventListener('click', authenticate);
startDialogueBtn.addEventListener('click', startDialogue);
pauseDialogueBtn.addEventListener('click', togglePauseDialogue);
nextPhaseBtn.addEventListener('click', nextPhase);
restartBtn.addEventListener('click', restart);
persona1Select.addEventListener('change', validatePersonaSelection);
persona2Select.addEventListener('change', validatePersonaSelection);
topicInput.addEventListener('input', validatePersonaSelection);
// Persona card selection
document.querySelectorAll('.persona-card').forEach(card => {
card.addEventListener('click', function() {
const persona = this.getAttribute('data-persona');
const selectElement = document.activeElement.tagName === 'SELECT' ? document.activeElement : null;
if (selectElement && (selectElement.id === 'persona1-select' || selectElement.id === 'persona2-select')) {
selectElement.value = persona;
validatePersonaSelection();
}
});
});
// Functions
function authenticate() {
const token = hfTokenInput.value.trim();
if (!token) {
alert('Please enter your Hugging Face access token');
return;
}
// Simple validation - in a real app, you'd verify the token with an API call
hfToken = token;
authSection.classList.add('hidden');
personaSection.classList.remove('hidden');
// Store token in sessionStorage for demo purposes
sessionStorage.setItem('hfToken', token);
}
function validatePersonaSelection() {
const p1 = persona1Select.value;
const p2 = persona2Select.value;
const topicValid = topicInput.value.trim().length > 0;
if (p1 && p2 && p1 !== p2 && topicValid) {
startDialogueBtn.disabled = false;
} else {
startDialogueBtn.disabled = true;
}
}
function startDialogue() {
persona1 = persona1Select.value;
persona2 = persona2Select.value;
topic = topicInput.value.trim();
// Update UI
personaSection.classList.add('hidden');
dialogueSection.classList.remove('hidden');
persona1Name.textContent = personas[persona1].name;
persona2Name.textContent = personas[persona2].name;
// Clear previous dialogue
dialogueContainer.innerHTML = '<div class="text-center text-gray-500 mt-32">The AI personas will discuss the topic here...</div>';
dialogueHistory = [];
dialoguePhase = 0;
// Start the dialogue
simulateDialogue();
}
function simulateDialogue() {
isDialoguePaused = false;
pauseDialogueBtn.textContent = 'Pause';
nextPhaseBtn.classList.add('hidden');
// Clear the dialogue container
dialogueContainer.innerHTML = '';
// Show typing indicator for persona 1
const typingIndicator1 = createTypingIndicator(persona1);
dialogueContainer.appendChild(typingIndicator1);
// First message from persona 1
setTimeout(() => {
dialogueContainer.removeChild(typingIndicator1);
const initialThought = generateInitialThought(persona1, topic);
const message1 = createMessageBubble(persona1, initialThought, 'left');
dialogueContainer.appendChild(message1);
dialogueHistory.push({persona: persona1, message: initialThought});
// Show typing indicator for persona 2
const typingIndicator2 = createTypingIndicator(persona2);
dialogueContainer.appendChild(typingIndicator2);
// First response from persona 2
setTimeout(() => {
dialogueContainer.removeChild(typingIndicator2);
const response = generateResponse(persona2, initialThought, topic);
const message2 = createMessageBubble(persona2, response, 'right');
dialogueContainer.appendChild(message2);
dialogueHistory.push({persona: persona2, message: response});
// Start the ongoing dialogue
dialogueInterval = setInterval(generateDialogueExchange, 3000);
}, 1500);
}, 2000);
}
function generateDialogueExchange() {
if (isDialoguePaused) return;
if (dialoguePhase < 5) {
// Alternate between personas
const lastMessage = dialogueHistory[dialogueHistory.length - 1];
const nextPersona = lastMessage.persona === persona1 ? persona2 : persona1;
// Show typing indicator
const typingIndicator = createTypingIndicator(nextPersona);
dialogueContainer.appendChild(typingIndicator);
setTimeout(() => {
dialogueContainer.removeChild(typingIndicator);
// Generate response based on the last message
const response = generateResponse(nextPersona, lastMessage.message, topic);
const bubble = createMessageBubble(nextPersona, response,
nextPersona === persona1 ? 'left' : 'right');
dialogueContainer.appendChild(bubble);
dialogueHistory.push({persona: nextPersona, message: response});
// Scroll to bottom
dialogueContainer.scrollTop = dialogueContainer.scrollHeight;
// Increment phase counter
dialoguePhase++;
// After 5 exchanges, show next phase button
if (dialoguePhase >= 5) {
clearInterval(dialogueInterval);
nextPhaseBtn.classList.remove('hidden');
}
}, 1500);
}
}
function togglePauseDialogue() {
isDialoguePaused = !isDialoguePaused;
pauseDialogueBtn.textContent = isDialoguePaused ? 'Resume' : 'Pause';
if (!isDialoguePaused && dialoguePhase < 5) {
dialogueInterval = setInterval(generateDialogueExchange, 3000);
} else if (isDialoguePaused) {
clearInterval(dialogueInterval);
}
}
function nextPhase() {
dialogueSection.classList.add('hidden');
refinementSection.classList.remove('hidden');
// Generate the refined outputs
generateRefinedOutputs();
}
function generateRefinedOutputs() {
// Simulate generating the refined outputs
setTimeout(() => {
contextOutput.textContent = `The dialogue explored the topic of "${topic}" through the lenses of ${personas[persona1].name} and ${personas[persona2].name}. The ${personas[persona1].name} approached it with ${personas[persona1].description.split('.')[0]}, while the ${personas[persona2].name} brought ${personas[personas[persona2].name.toLowerCase()].description.split('.')[0]}.`;
commonGroundOutput.textContent = `Both personas agreed that ${topic} is a multifaceted concept that ${getCommonGround(persona1, persona2)}. They found commonality in their appreciation for ${getCommonAppreciation(persona1, persona2)}.`;
differencesOutput.textContent = `The main differences emerged in ${getDifferenceArea(persona1, persona2)}. The ${personas[persona1].name} emphasized ${getEmphasis(persona1)}, while the ${personas[persona2].name} focused more on ${getEmphasis(persona2)}.`;
poemOutput.textContent = generatePoem(topic, persona1, persona2);
// Simulate image generation
setTimeout(() => {
imageOutput.innerHTML = `<img src="https://source.unsplash.com/random/600x400/?${encodeURIComponent(topic)},abstract,art" alt="AI generated interpretation of the poem" class="w-full h-full object-cover rounded-lg">`;
}, 1000);
}, 500);
}
function restart() {
refinementSection.classList.add('hidden');
personaSection.classList.remove('hidden');
// Reset selections
persona1Select.value = '';
persona2Select.value = '';
topicInput.value = '';
startDialogueBtn.disabled = true;
}
function createTypingIndicator(persona) {
const typingDiv = document.createElement('div');
typingDiv.className = `flex items-center mb-2 ${persona === persona1 ? 'justify-start' : 'justify-end'}`;
const typingContainer = document.createElement('div');
typingContainer.className = `typing-indicator bg-${personas[persona].color}-100 rounded-full px-3 py-2`;
for (let i = 0; i < 3; i++) {
const dot = document.createElement('div');
dot.className = 'typing-dot';
typingContainer.appendChild(dot);
}
typingDiv.appendChild(typingContainer);
return typingDiv;
}
function createMessageBubble(persona, message, side) {
const messageDiv = document.createElement('div');
messageDiv.className = `flex mb-3 ${side === 'left' ? 'justify-start' : 'justify-end'}`;
const bubbleDiv = document.createElement('div');
bubbleDiv.className = `dialogue-bubble ${side === 'left' ? 'left-bubble' : 'right-bubble'} fade-in`;
bubbleDiv.innerHTML = marked.parse(message);
messageDiv.appendChild(bubbleDiv);
return messageDiv;
}
// Content generation functions (simplified for demo)
function generateInitialThought(persona, topic) {
const personaData = personas[persona];
switch(persona) {
case 'philosopher':
return `As I contemplate "${topic}", I'm drawn to the fundamental questions it raises about human existence. What does it mean to truly experience ${topic}? Is ${topic} an objective reality or a subjective construct of our minds?`;
case 'poet':
return `Oh, ${topic}! Like a butterfly's wing against the morning dew, so delicate yet bursting with color. How does one capture the essence of ${topic} in mere words? It dances at the edge of perception, always just beyond reach.`;
case 'historian':
return `Looking back through history, ${topic} has played a pivotal role in shaping civilizations. From ancient times to modern era, the pursuit of ${topic} has driven human progress and conflict alike. What lessons can we learn from our ancestors about ${topic}?`;
case 'critic':
return `${topic} presents itself as a fascinating subject for aesthetic analysis. The interplay of form and meaning in ${topic} creates a rich tapestry of interpretation. How do we evaluate ${topic} as both an experience and an artistic construct?`;
case 'kid':
return `Wow, ${topic} is so cool! It's like when you see a rainbow or get a new toy. Why do grown-ups make ${topic} so complicated? It's just awesome!`;
case 'engineer':
return `Examining ${topic} from a systems perspective reveals interesting patterns. The efficiency of ${topic} can be optimized by applying first principles. What are the measurable parameters that define successful ${topic}?`;
default:
return `Let's discuss ${topic}.`;
}
}
function generateResponse(persona, lastMessage, topic) {
const personaData = personas[persona];
switch(persona) {
case 'philosopher':
return `Your perspective on ${topic} raises important epistemological questions. Building on your thoughts, I would argue that ${topic} exists in the interplay between being and becoming. The ancient Greeks might say...`;
case 'poet':
return `Your words about ${topic} sing to my soul! Let me add this verse: "Like ${topic} in spring's embrace, we dance on edges of time and space." There's music in how you describe ${topic}.`;
case 'historian':
return `Fascinating! This reminds me of how ${topic} influenced the Renaissance period. The parallels between then and now regarding ${topic} are striking, wouldn't you agree?`;
case 'critic':
return `I appreciate your analysis of ${topic}. From an art criticism standpoint, we might also consider how ${topic} challenges traditional aesthetic boundaries. The postmodern interpretation would be...`;
case 'kid':
return `Yeah! And ${topic} is also like when you eat ice cream and it's all melty but still yummy! Why can't ${topic} always be fun like that?`;
case 'engineer':
return `Your observations about ${topic} suggest an opportunity for systematic improvement. If we model ${topic} as a function with these variables, we could optimize for better outcomes.`;
default:
return `I'd like to add my thoughts about ${topic}.`;
}
}
function getCommonGround(p1, p2) {
if ((p1 === 'philosopher' && p2 === 'historian') || (p1 === 'historian' && p2 === 'philosopher')) {
return "requires understanding through both time and abstract thought";
} else if ((p1 === 'poet' && p2 === 'critic') || (p1 === 'critic' && p2 === 'poet')) {
return "demands deep emotional engagement and aesthetic appreciation";
} else if ((p1 === 'kid' && p2 === 'engineer') || (p1 === 'engineer' && p2 === 'kid')) {
return "benefits from both simplicity and systematic thinking";
} else {
return "has value that transcends any single perspective";
}
}
function getCommonAppreciation(p1, p2) {
if (p1 === 'philosopher' || p2 === 'philosopher') {
return "the depth of human thought";
} else if (p1 === 'poet' || p2 === 'poet') {
return "the beauty of expression";
} else if (p1 === 'historian' || p2 === 'historian') {
return "the lessons of history";
} else if (p1 === 'critic' || p2 === 'critic') {
return "the nuances of interpretation";
} else if (p1 === 'kid' || p2 === 'kid') {
return "the joy of discovery";
} else {
return "the power of innovation";
}
}
function getDifferenceArea(p1, p2) {
if (p1 === 'philosopher' || p2 === 'philosopher') {
return "the balance between abstract reasoning and practical application";
} else if (p1 === 'poet' || p2 === 'poet') {
return "the role of emotion versus analysis";
} else if (p1 === 'historian' || p2 === 'historian') {
return "the weight given to historical context versus present experience";
} else if (p1 === 'critic' || p2 === 'critic') {
return "the standards used for evaluation";
} else if (p1 === 'kid' || p2 === 'kid') {
return "the level of complexity considered valuable";
} else {
return "the approach to problem-solving";
}
}
function getEmphasis(persona) {
switch(persona) {
case 'philosopher': return "theoretical frameworks and logical consistency";
case 'poet': return "emotional resonance and metaphorical richness";
case 'historian': return "historical precedents and contextual understanding";
case 'critic': return "aesthetic principles and interpretive depth";
case 'kid': return "immediate experience and unfiltered wonder";
case 'engineer': return "practical applications and systematic solutions";
default: return "their unique perspective";
}
}
function generatePoem(topic, p1, p2) {
const persona1Data = personas[p1];
const persona2Data = personas[p2];
return `The ${topic} Dialogue\n\n` +
`[${persona1Data.name}'s verse]\n` +
`${getPoemVerse(p1, topic)}\n\n` +
`[${persona2Data.name}'s response]\n` +
`${getPoemVerse(p2, topic)}\n\n` +
`[Together]\n` +
`In the space between our minds,\n` +
`Where ${p1} and ${p2} intertwine,\n` +
`${topic} takes a shape so new,\n` +
`More than what each alone knew.\n\n` +
`Through dialogue we come to see\n` +
`The greater truth of ${topic} free,\n` +
`From single view or narrow thought,\n` +
`A richer understanding wrought.`;
}
function getPoemVerse(persona, topic) {
switch(persona) {
case 'philosopher':
return `What is ${topic} but a thought,\n` +
`A concept that the mind has caught?\n` +
`Beyond the veil of what seems real,\n` +
`Its essence we attempt to feel.`;
case 'poet':
return `${topic}! Like a bird in flight,\n` +
`A burst of color, pure and bright.\n` +
`It sings in hues beyond compare,\n` +
`A melody that fills the air.`;
case 'historian':
return `Through ages past ${topic} has grown,\n` +
`In seeds of time its truth was sown.\n` +
`Each era adds its layer deep,\n` +
`In history's book its story's kept.`;
case 'critic':
return `Observe how ${topic} plays its part,\n` +
`A work of art that moves the heart.\n` +
`Its form and function, light and shade,\n` +
`A masterpiece that will not fade.`;
case 'kid':
return `${topic} is fun! It's big! It's wow!\n` +
`Like puppies playing, here and now!\n` +
`Why make it hard? It's simple, see?\n` +
`Just be happy, like ${topic} makes me!`;
case 'engineer':
return `The system of ${topic}, clean and neat,\n` +
`Efficient patterns, logic sweet.\n` +
`Optimized for perfect flow,\n` +
`A well-designed conceptual show.`;
default:
return `About ${topic} I have much to say,\n` +
`In my own special way.\n` +
`Let's share our thoughts and then we'll see\n` +
`The ${topic} that emerges free.`;
}
}
// Check for existing token in sessionStorage
if (sessionStorage.getItem('hfToken')) {
hfTokenInput.value = sessionStorage.getItem('hfToken');
authBtn.click();
}
</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=Dumoura/frontend-of-reductive-dialogue" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>