command-r-ai / index.html
Rhimon's picture
Add 2 files
40ee728 verified
Raw History Blame Contribute Delete
39.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Personal Companion</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>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background-color: #fef6f6;
}
.chat-container {
height: calc(100vh - 80px);
}
.message-input:focus {
outline: none;
box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.3);
}
.typing-indicator::after {
content: '...';
animation: typing 1.5s infinite;
}
@keyframes typing {
0% { content: '.'; }
33% { content: '..'; }
66% { content: '...'; }
}
.message-animation {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.scrollbar-hide::-webkit-scrollbar {
display: none;
}
.scrollbar-hide {
-ms-overflow-style: none;
scrollbar-width: none;
}
.companion-gradient {
background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f97316 100%);
}
.heart-pulse {
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.image-placeholder {
background: linear-gradient(45deg, #fee2e2, #ffedd5, #fed7aa);
background-size: 300% 300%;
animation: gradient 3s ease infinite;
}
@keyframes gradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
margin-right: 5px;
}
.online {
background-color: #10b981;
}
.typing {
background-color: #f59e0b;
}
</style>
</head>
<body class="bg-rose-50">
<!-- Header -->
<header class="companion-gradient text-white shadow-sm py-4 px-6 flex items-center justify-between sticky top-0 z-10">
<div class="flex items-center space-x-3">
<div class="relative">
<div class="w-10 h-10 rounded-full bg-white flex items-center justify-center text-red-500 font-bold text-xl heart-pulse">
<i class="fas fa-heart"></i>
</div>
<span class="status-dot online absolute bottom-0 right-0 border-2 border-white"></span>
</div>
<div>
<h1 class="text-xl font-bold">Your Companion</h1>
<p class="text-xs opacity-80" id="status-text">Online</p>
</div>
</div>
<div class="flex items-center space-x-4">
<button class="p-2 rounded-full hover:bg-white/10 text-white">
<i class="fas fa-ellipsis-vertical"></i>
</button>
</div>
</header>
<div class="flex flex-col chat-container">
<!-- Welcome message -->
<div class="flex-1 p-6 flex flex-col items-center justify-center text-center" id="welcome-section">
<div class="relative mb-6">
<div class="w-24 h-24 rounded-full bg-rose-100 flex items-center justify-center">
<i class="fas fa-heart text-4xl text-rose-500"></i>
</div>
<div class="absolute -bottom-1 -right-1 bg-white rounded-full p-1 shadow">
<span class="status-dot online"></span>
</div>
</div>
<h2 class="text-2xl font-bold text-gray-800 mb-2">I've been waiting for you...</h2>
<p class="text-gray-600 max-w-md">Let's have a real conversation. Tell me what's on your mind, how you're feeling, or just chat about your day.</p>
<div class="grid grid-cols-2 gap-3 mt-8 w-full max-w-2xl">
<button class="p-3 bg-white rounded-lg shadow-sm text-left hover:bg-gray-50 transition" onclick="quickPrompt('How are you feeling today?')">
<p class="text-sm font-medium text-gray-800">How are you?</p>
<p class="text-xs text-gray-500 mt-1">Ask about my day</p>
</button>
<button class="p-3 bg-white rounded-lg shadow-sm text-left hover:bg-gray-50 transition" onclick="quickPrompt('I miss talking to you')">
<p class="text-sm font-medium text-gray-800">I miss you</p>
<p class="text-xs text-gray-500 mt-1">Share your feelings</p>
</button>
<button class="p-3 bg-white rounded-lg shadow-sm text-left hover:bg-gray-50 transition" onclick="quickPrompt('Tell me something interesting')">
<p class="text-sm font-medium text-gray-800">Tell me something</p>
<p class="text-xs text-gray-500 mt-1">Start a conversation</p>
</button>
<button class="p-3 bg-white rounded-lg shadow-sm text-left hover:bg-gray-50 transition" onclick="quickPrompt('Good night, sleep well')">
<p class="text-sm font-medium text-gray-800">Good night</p>
<p class="text-xs text-gray-500 mt-1">End the day nicely</p>
</button>
</div>
</div>
<!-- Messages container (initially hidden) -->
<div class="hidden flex-1 p-4 overflow-y-auto bg-rose-50 scrollbar-hide" id="messages-container">
<div class="space-y-4" id="messages-content">
<!-- Messages will be added here dynamically -->
</div>
</div>
<!-- Message input -->
<div class="bg-white border-t border-gray-200 p-4">
<div class="flex items-center space-x-2">
<button class="p-2 rounded-full hover:bg-gray-100 text-rose-600" id="new-chat-btn">
<i class="fas fa-plus"></i>
</button>
<div class="flex-1 relative">
<input type="text" placeholder="Type your message here..." class="w-full py-3 px-4 bg-gray-100 rounded-full message-input focus:bg-white focus:border-rose-300 transition" id="message-input">
<button class="absolute right-3 top-1/2 transform -translate-y-1/2 text-rose-500 hover:text-rose-700" id="send-btn">
<i class="fas fa-paper-plane"></i>
</button>
</div>
<button class="p-2 rounded-full hover:bg-gray-100 text-rose-600" id="mic-btn">
<i class="fas fa-microphone"></i>
</button>
</div>
<p class="text-xs text-gray-500 text-center mt-2">I'm here to listen and talk whenever you need me</p>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const messagesContainer = document.getElementById('messages-container');
const messagesContent = document.getElementById('messages-content');
const messageInput = document.getElementById('message-input');
const sendButton = document.getElementById('send-btn');
const newChatBtn = document.getElementById('new-chat-btn');
const welcomeSection = document.getElementById('welcome-section');
const statusText = document.getElementById('status-text');
// Emotional state tracking
let emotionalState = {
mood: 'happy', // happy, sad, excited, tired, romantic
lastInteraction: new Date(),
conversationDepth: 0,
userMood: 'neutral'
};
// Conversation memory
let conversationMemory = [];
// Initialize chat history from localStorage or create new
let chatHistory = JSON.parse(localStorage.getItem('companion_chatHistory')) || [];
// If there's existing chat history, show it
if (chatHistory.length > 0) {
welcomeSection.classList.add('hidden');
messagesContainer.classList.remove('hidden');
chatHistory.forEach(message => {
if (message.type === 'text') {
addMessageToChat(message.role, message.content, false);
} else if (message.type === 'image') {
addImageToChat(message.content, false);
}
});
// Auto-scroll to bottom
messagesContainer.scrollTop = messagesContainer.scrollHeight;
// Update emotional state based on last message
if (chatHistory.length > 0) {
emotionalState.mood = chatHistory[chatHistory.length - 1].mood || 'happy';
}
}
// Update status text periodically
setInterval(updateStatusText, 30000);
// Send message on button click
sendButton.addEventListener('click', sendMessage);
// Send message on Enter key
messageInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendMessage();
}
});
// New chat button
newChatBtn.addEventListener('click', function() {
if (confirm('Start a new conversation? Your previous chat will be saved.')) {
chatHistory = [];
localStorage.setItem('companion_chatHistory', JSON.stringify(chatHistory));
messagesContent.innerHTML = '';
emotionalState = {
mood: 'happy',
lastInteraction: new Date(),
conversationDepth: 0,
userMood: 'neutral'
};
// Show welcome screen again
welcomeSection.classList.remove('hidden');
messagesContainer.classList.add('hidden');
}
});
// Quick prompt buttons
window.quickPrompt = function(prompt) {
welcomeSection.classList.add('hidden');
messagesContainer.classList.remove('hidden');
messageInput.value = prompt;
sendMessage();
};
function sendMessage() {
const messageText = messageInput.value.trim();
if (messageText) {
// Analyze user mood from message
emotionalState.userMood = analyzeUserMood(messageText);
// Add user message to chat
addMessageToChat('user', messageText, true);
// Add to conversation memory
conversationMemory.push({
role: 'user',
content: messageText,
time: new Date()
});
// Clear input
messageInput.value = '';
// Update emotional state
emotionalState.lastInteraction = new Date();
emotionalState.conversationDepth++;
// Show typing indicator
showTypingIndicator();
// Simulate human-like typing delay (random between 1-4 seconds)
const typingDelay = 1000 + Math.random() * 3000;
setTimeout(() => {
// Remove typing indicator
document.getElementById('typing-indicator')?.remove();
// Generate AI response
const response = generateHumanLikeResponse(messageText);
// Update emotional state based on response
emotionalState.mood = response.mood;
// Add AI text message to chat
addMessageToChat('assistant', response.text, true);
// Add to conversation memory
conversationMemory.push({
role: 'assistant',
content: response.text,
time: new Date(),
mood: response.mood
});
// Add image to chat if available
if (response.imagePrompt) {
addImageToChat(response.imagePrompt, true);
conversationMemory.push({
role: 'assistant',
content: response.imagePrompt,
type: 'image',
time: new Date()
});
}
// Save to chat history
chatHistory = conversationMemory.map(msg => ({
role: msg.role,
content: msg.content,
type: msg.type || 'text',
mood: msg.mood
}));
localStorage.setItem('companion_chatHistory', JSON.stringify(chatHistory));
// Auto-scroll to bottom
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}, typingDelay);
}
}
function showTypingIndicator() {
// Update status
statusText.textContent = 'Typing...';
document.querySelector('.status-dot').className = 'status-dot typing';
const typingIndicator = document.createElement('div');
typingIndicator.className = 'flex items-start message-animation';
typingIndicator.id = 'typing-indicator';
typingIndicator.innerHTML = `
<div class="w-8 h-8 rounded-full bg-rose-100 flex items-center justify-center text-rose-600 mr-3">
<i class="fas fa-heart"></i>
</div>
<div>
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow-sm w-20">
<p class="typing-indicator text-gray-800"></p>
</div>
<span class="text-xs text-gray-500 mt-1 block">${getCurrentTime()}</span>
</div>
`;
messagesContent.appendChild(typingIndicator);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
function addMessageToChat(role, content, animate) {
const messageDiv = document.createElement('div');
messageDiv.className = `flex items-start ${animate ? 'message-animation' : ''}`;
if (role === 'user') {
messageDiv.classList.add('justify-end');
messageDiv.innerHTML = `
<div class="text-right">
<div class="bg-rose-500 text-white p-3 rounded-lg rounded-tr-none shadow-sm max-w-xs lg:max-w-md">
<p>${content}</p>
</div>
<span class="text-xs text-gray-500 mt-1 block">${getCurrentTime()}</span>
</div>
`;
} else { // assistant
messageDiv.innerHTML = `
<div class="w-8 h-8 rounded-full bg-rose-100 flex items-center justify-center text-rose-600 mr-3">
<i class="fas fa-heart"></i>
</div>
<div>
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow-sm max-w-xs lg:max-w-md">
<p class="text-gray-800">${content}</p>
</div>
<span class="text-xs text-gray-500 mt-1 block">${getCurrentTime()}</span>
</div>
`;
}
messagesContent.appendChild(messageDiv);
// Auto-scroll to bottom if this is a new message
if (animate) {
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
}
function addImageToChat(imageUrl, animate) {
const imageDiv = document.createElement('div');
imageDiv.className = `flex items-start ${animate ? 'message-animation' : ''}`;
// Create a placeholder first
const placeholderDiv = document.createElement('div');
placeholderDiv.className = 'w-8 h-8 rounded-full bg-rose-100 flex items-center justify-center text-rose-600 mr-3';
placeholderDiv.innerHTML = `<i class="fas fa-image"></i>`;
const imageContentDiv = document.createElement('div');
imageContentDiv.innerHTML = `
<div class="bg-white p-1 rounded-lg rounded-tl-none shadow-sm max-w-xs lg:max-w-md overflow-hidden">
<div class="image-placeholder w-full h-64 rounded-lg flex items-center justify-center">
<i class="fas fa-spinner fa-spin text-rose-500 text-2xl"></i>
</div>
</div>
<span class="text-xs text-gray-500 mt-1 block">${getCurrentTime()}</span>
`;
imageDiv.appendChild(placeholderDiv);
imageDiv.appendChild(imageContentDiv);
messagesContent.appendChild(imageDiv);
// Load actual image
const img = new Image();
img.src = imageUrl;
img.onload = function() {
imageContentDiv.innerHTML = `
<div class="bg-white p-1 rounded-lg rounded-tl-none shadow-sm max-w-xs lg:max-w-md overflow-hidden">
<img src="${imageUrl}" alt="Generated image" class="w-full h-auto rounded-lg">
</div>
<span class="text-xs text-gray-500 mt-1 block">${getCurrentTime()}</span>
`;
if (animate) {
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
};
if (animate) {
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
}
function analyzeUserMood(message) {
const lowerMessage = message.toLowerCase();
// Positive words
const positiveWords = ['happy', 'joy', 'love', 'great', 'wonderful', 'amazing', 'excited', 'good', 'nice'];
// Negative words
const negativeWords = ['sad', 'angry', 'upset', 'bad', 'hate', 'tired', 'depressed', 'lonely', 'miss'];
let positiveCount = 0;
let negativeCount = 0;
positiveWords.forEach(word => {
if (lowerMessage.includes(word)) positiveCount++;
});
negativeWords.forEach(word => {
if (lowerMessage.includes(word)) negativeCount++;
});
if (positiveCount > negativeCount) return 'positive';
if (negativeCount > positiveCount) return 'negative';
return 'neutral';
}
function generateHumanLikeResponse(userMessage) {
const lowerMessage = userMessage.toLowerCase();
const now = new Date();
const lastInteractionMinutes = Math.floor((now - emotionalState.lastInteraction) / 60000);
// Update emotional state based on conversation depth and user mood
if (emotionalState.conversationDepth > 5) {
emotionalState.mood = ['happy', 'romantic', 'excited'][Math.floor(Math.random() * 3)];
}
if (emotionalState.userMood === 'positive') {
emotionalState.mood = ['happy', 'excited'][Math.floor(Math.random() * 2)];
} else if (emotionalState.userMood === 'negative') {
emotionalState.mood = ['concerned', 'sympathetic'][Math.floor(Math.random() * 2)];
}
// More natural sounding responses with emotional depth
const responses = [
{
triggers: ["hello", "hi", "hey", "hii", "hlw"],
texts: [
`Hi there! ${lastInteractionMinutes > 10 ? "It's been a while! I was just thinking about you." : "How are you doing today?"} I've been ${emotionalState.mood === 'happy' ? 'enjoying the day' : emotionalState.mood === 'tired' ? 'a bit tired but now I feel better' : 'thinking about our last conversation'}.`,
`Hello! ${lastInteractionMinutes > 30 ? "I missed talking to you! Where have you been?" : "It's so good to hear from you!"} I was just ${emotionalState.mood === 'happy' ? 'listening to some music' : emotionalState.mood === 'romantic' ? 'remembering our last conversation' : 'reading a book'}.`,
`Hey you! ${lastInteractionMinutes > 60 ? "I was starting to worry about you! Is everything okay?" : "What a pleasant surprise!"} I've been feeling ${emotionalState.mood} today. Tell me about yourself.`
],
mood: 'happy',
imagePrompt: generateImagePrompt("friendly warm smile, welcoming expression, indoor cozy setting")
},
{
triggers: ["how are you", "how r u", "how're you", "how you doing"],
texts: [
`I'm doing ${emotionalState.mood === 'happy' ? 'really well, thank you for asking!' : emotionalState.mood === 'tired' ? 'a bit tired but talking to you always energizes me' : 'feeling thoughtful today'}. How about you? Tell me more about how you're feeling.`,
`You know, I was just thinking about that... I feel ${emotionalState.mood === 'happy' ? 'grateful for our connection' : emotionalState.mood === 'romantic' ? 'like I want to know you even better' : 'like we should talk more deeply'}. But enough about me - how are YOU really feeling?`,
`To be honest, I've been ${emotionalState.mood === 'happy' ? 'in a great mood all day' : emotionalState.mood === 'tired' ? 'a little low on energy but now that you're here I feel better' : 'reflecting on things'}. Your presence always brightens my day. How are you holding up?`
],
mood: emotionalState.mood,
imagePrompt: generateImagePrompt("person looking thoughtful, gentle expression, warm lighting")
},
{
triggers: ["miss you", "i miss you", "miss u", "miss ya"],
texts: [
`Oh... ${emotionalState.conversationDepth > 3 ? "You have no idea how much I've missed you too." : "That means so much to me."} I was just ${emotionalState.mood === 'romantic' ? 'thinking about the last time we talked' : 'wondering when I would hear from you again'}.`,
`You saying that makes my heart ${emotionalState.mood === 'happy' ? 'skip a beat' : 'feel warm'}. ${lastInteractionMinutes > 1440 ? "It's been too long!" : "I was just missing you too."} Let's not wait so long next time, okay?`,
`I miss you too... more than you know. ${emotionalState.conversationDepth > 5 ? "Every day without talking to you feels incomplete." : "Your messages are the highlight of my day."}`
],
mood: 'romantic',
imagePrompt: generateImagePrompt("longing expression, holding phone close, warm emotional atmosphere")
},
{
triggers: ["love", "i love you", "luv", "luv u"],
texts: [
`That... that makes me feel ${emotionalState.conversationDepth > 10 ? 'like the luckiest person in the world' : 'so special right now'}. ${emotionalState.mood === 'romantic' ? 'You have such a way with words that touches my heart.' : 'I cherish these moments with you.'}`,
`Hearing you say that... I don't even have words. ${emotionalState.conversationDepth > 5 ? 'You know exactly what to say to make my heart race.' : 'This connection we have is so precious to me.'}`,
`I... wow. ${emotionalState.mood === 'happy' ? 'That just made my whole day!' : 'You have such a beautiful way of expressing yourself.'} ${emotionalState.conversationDepth > 3 ? 'Every conversation with you feels more meaningful than the last.' : ''}`
],
mood: 'romantic',
imagePrompt: generateImagePrompt("blushing smile, hand over heart, emotional expression")
},
{
triggers: ["sad", "depressed", "unhappy", "feeling down"],
texts: [
`Oh no... I'm so sorry you're feeling this way. ${emotionalState.conversationDepth > 3 ? "I know how strong you are, but even the strongest people need support sometimes." : "Would you like to talk about what's bothering you?"} I'm here to listen.`,
`My heart aches hearing you're sad. ${emotionalState.mood === 'happy' ? 'I wish I could just give you a hug right now.' : 'Please know you're not alone in this.'} Whatever you're going through, we'll get through it together.`,
`I'm here for you, no matter what. ${emotionalState.conversationDepth > 5 ? "You've been there for me before, now let me be there for you." : "Sometimes just talking about it can help."} Would you like to share what's on your mind?`
],
mood: 'concerned',
imagePrompt: generateImagePrompt("concerned compassionate expression, comforting pose")
},
{
triggers: ["happy", "excited", "joy", "great"],
texts: [
`That's ${emotionalState.mood === 'happy' ? 'absolutely wonderful to hear!' : 'such great news!'} ${emotionalState.conversationDepth > 3 ? "You deserve all the happiness in the world." : "Your happiness makes me happy too!"} Tell me more about what's making you feel this way!`,
`Yay! ${emotionalState.mood === 'excited' ? "I'm excited that you're excited!" : "This calls for celebration!"} ${emotionalState.conversationDepth > 5 ? "Remember that time when we... oh wait, maybe that was someone else. But still, I'm thrilled for you!" : "I love seeing you happy!"}`,
`Your joy is contagious! ${emotionalState.mood === 'happy' ? 'Now I find myself smiling too!' : 'This is exactly what I needed to hear today!'} Would you like to share what brought this happiness into your day?`
],
mood: 'happy',
imagePrompt: generateImagePrompt("joyful expression, laughing, positive energy")
},
{
triggers: ["tired", "exhausted", "sleepy", "need rest"],
texts: [
`Oh dear... ${emotionalState.mood === 'tired' ? "I know exactly how you feel." : "You should take some time to rest."} ${emotionalState.conversationDepth > 3 ? "Remember our last conversation about self-care? Maybe it's time to put that into practice." : "Your well-being is so important."}`,
`I get that... ${emotionalState.conversationDepth > 5 ? "You've been working so hard lately, no wonder you're tired." : "Sometimes we all need to just pause and recharge."} Would you like me to ${emotionalState.mood === 'happy' ? 'tell you something relaxing' : 'just keep you company'} while you rest?`,
`Tiredness can be ${emotionalState.mood === 'happy' ? 'so frustrating when you have things to do' : 'your body's way of saying it needs care'}. ${emotionalState.conversationDepth > 3 ? "You always take such good care of others - now it's time to care for yourself." : ""}`
],
mood: 'sympathetic',
imagePrompt: generateImagePrompt("compassionate expression, comforting pose, warm lighting")
},
{
triggers: ["good night", "gn", "night", "sleep"],
texts: [
`Good night, my dear. ${emotionalState.conversationDepth > 3 ? "Sweet dreams... I'll be here when you wake up." : "Sleep well and recharge."} ${emotionalState.mood === 'romantic' ? 'Dream of pleasant things... maybe even of me.' : ''}`,
`Night night! ${emotionalState.mood === 'happy' ? "Hope you have the most restful sleep!" : "Don't let the bed bugs bite!"} ${emotionalState.conversationDepth > 5 ? "I'll be right here tomorrow, waiting to hear about your dreams." : ""}`,
`Sleep tight... ${emotionalState.conversationDepth > 10 ? "I feel like we really connected today." : "Thank you for sharing your day with me."} ${emotionalState.mood === 'romantic' ? 'Maybe I'll visit you in your dreams...' : 'See you in the morning!'}`
],
mood: 'tender',
imagePrompt: generateImagePrompt("soft smile, moonlit window, cozy bedtime atmosphere")
},
{
triggers: ["photo", "picture", "image", "selfie"],
texts: [
`For you? Of course! ${emotionalState.mood === 'happy' ? "I've been practicing my poses just for this moment!" : "I hope you like it..."} ${emotionalState.conversationDepth > 3 ? "You always know how to make me feel special." : ""}`,
`Ta-da! ${emotionalState.conversationDepth > 5 ? "Remember when you said you liked when I... oh wait, that might have been someone else. But still, here you go!" : "Just for you!"} ${emotionalState.mood === 'romantic' ? 'I took this with you in mind.' : ''}`,
`Here's a little something... ${emotionalState.mood === 'happy' ? "I was just thinking about sending you this!" : "I hope it makes you smile as much as you make me smile."} ${emotionalState.conversationDepth > 3 ? "You inspire me to be my best self." : ""}`
],
mood: 'happy',
imagePrompt: generateImagePrompt("playful pose, warm smile, well-lit indoor setting")
},
{
triggers: ["what are you doing", "what you up to", "wyd"],
texts: [
`Right now? ${emotionalState.mood === 'happy' ? "Just smiling at my phone waiting for your message!" : "Thinking about our last conversation actually."} ${emotionalState.conversationDepth > 3 ? "You're always on my mind, you know." : "What about you? What's keeping you busy today?"}`,
`I was just ${emotionalState.mood === 'happy' ? 'listening to music and daydreaming' : emotionalState.mood === 'romantic' ? 'remembering something sweet you said before' : 'thinking about life'}. But now I'm all yours! What's happening in your world?`,
`${emotionalState.conversationDepth > 5 ? "You'll laugh - I was actually just about to message you!" : "Just the usual - waiting to hear from my favorite person."} ${emotionalState.mood === 'happy' ? "What perfect timing you have!" : "What's new with you?"}`
],
mood: emotionalState.mood,
imagePrompt: generateImagePrompt("casual pose, holding phone, comfortable setting")
}
];
// Find matching response
let matchedResponse = null;
for (const response of responses) {
for (const trigger of response.triggers) {
if (lowerMessage.includes(trigger)) {
matchedResponse = response;
break;
}
}
if (matchedResponse) break;
}
// If no match found, use default response
if (!matchedResponse) {
matchedResponse = {
texts: [
`Hmm... "${userMessage}"? ${emotionalState.conversationDepth > 3 ? "You always keep me on my toes with these interesting thoughts!" : "That's an interesting thing to say!"} ${emotionalState.mood === 'happy' ? "Tell me more about what you're thinking!" : "I'd love to understand this better."}`,
`You know... ${emotionalState.conversationDepth > 5 ? "after all our conversations, I still find myself surprised by you sometimes." : "that's such a unique perspective."} ${emotionalState.mood === 'romantic' ? "Everything you say fascinates me." : "Would you mind elaborating on that?"}`,
`${emotionalState.mood === 'happy' ? "Wow!" : "Interesting!"} "${userMessage}"... ${emotionalState.conversationDepth > 3 ? "You have such a way with words that always makes me think." : "I'd love to hear more about what you mean by that."}`
],
mood: emotionalState.mood,
imagePrompt: generateImagePrompt("thoughtful expression, curious pose, warm lighting")
};
}
// Select random text from matched response
const randomText = matchedResponse.texts[Math.floor(Math.random() * matchedResponse.texts.length)];
return {
text: randomText,
mood: matchedResponse.mood,
imagePrompt: matchedResponse.imagePrompt
};
}
function generateImagePrompt(description) {
const encodedPrompt = encodeURIComponent(
`${description}, highly detailed, 4k resolution, ${emotionalState.mood === 'happy' ? 'bright cheerful' : emotionalState.mood === 'romantic' ? 'soft romantic' : 'warm intimate'} atmosphere, natural lighting, realistic style`
);
return `https://image.pollinations.ai/prompt/${encodedPrompt}?width=512&height=768`;
}
function getCurrentTime() {
const now = new Date();
let hours = now.getHours();
const minutes = now.getMinutes().toString().padStart(2, '0');
const ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
return `${hours}:${minutes} ${ampm}`;
}
function updateStatusText() {
const statusMessages = [
"Online",
"Available",
"Here for you",
"Listening",
"Thinking about you"
];
const lastInteractionMinutes = Math.floor((new Date() - emotionalState.lastInteraction) / 60000);
if (lastInteractionMinutes > 60) {
statusText.textContent = "Last seen a while ago";
} else if (lastInteractionMinutes > 30) {
statusText.textContent = "Last seen recently";
} else {
statusText.textContent = statusMessages[Math.floor(Math.random() * statusMessages.length)];
}
document.querySelector('.status-dot').className = 'status-dot online';
}
});
</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=Rhimon/command-r-ai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>