|
|
<!doctype html> |
|
|
<!DOCTYPE html> |
|
|
<html lang="en"> |
|
|
<head> |
|
|
<meta charset="UTF-8"> |
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
<title>Bigkas Uno - Uncensored AI Chat Platform</title> |
|
|
<script src="https://cdn.tailwindcss.com"></script> |
|
|
<script src="https://cdn.jsdelivr.net/npm/marked@9.1.2/marked.min.js"></script> |
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;700;900&display=swap" rel="stylesheet"> |
|
|
<script> |
|
|
tailwind.config = { |
|
|
theme: { |
|
|
extend: { |
|
|
fontFamily: { |
|
|
'sans': ['Inter', 'system-ui', 'sans-serif'], |
|
|
'brand': ['Orbitron', 'monospace'], |
|
|
}, |
|
|
animation: { |
|
|
'gradient': 'gradient 8s ease infinite', |
|
|
'pulse-slow': 'pulse 3s infinite', |
|
|
'float': 'float 6s ease-in-out infinite', |
|
|
'glow': 'glow 2s ease-in-out infinite alternate', |
|
|
}, |
|
|
keyframes: { |
|
|
gradient: { |
|
|
'0%, 100%': { 'background-position': '0% 50%' }, |
|
|
'50%': { 'background-position': '100% 50%' }, |
|
|
}, |
|
|
float: { |
|
|
'0%, 100%': { transform: 'translateY(0px)' }, |
|
|
'50%': { transform: 'translateY(-10px)' }, |
|
|
}, |
|
|
glow: { |
|
|
'0%': { boxShadow: '0 0 20px rgba(93, 92, 222, 0.5)' }, |
|
|
'100%': { boxShadow: '0 0 30px rgba(147, 51, 234, 0.8)' }, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
<style> |
|
|
.trinomic-gradient { |
|
|
background: linear-gradient(-45deg, #5D5CDE, #9333EA, #EC4899, #F59E0B); |
|
|
background-size: 400% 400%; |
|
|
} |
|
|
|
|
|
.trinomic-gradient-subtle { |
|
|
background: linear-gradient(135deg, rgba(93, 92, 222, 0.1), rgba(147, 51, 234, 0.1), rgba(236, 72, 153, 0.1)); |
|
|
} |
|
|
|
|
|
.chat-message { |
|
|
animation: slideInUp 0.3s ease-out; |
|
|
} |
|
|
|
|
|
@keyframes slideInUp { |
|
|
from { |
|
|
opacity: 0; |
|
|
transform: translateY(20px); |
|
|
} |
|
|
to { |
|
|
opacity: 1; |
|
|
transform: translateY(0); |
|
|
} |
|
|
} |
|
|
|
|
|
.typing-indicator { |
|
|
display: inline-flex; |
|
|
align-items: center; |
|
|
} |
|
|
|
|
|
.typing-dot { |
|
|
width: 6px; |
|
|
height: 6px; |
|
|
border-radius: 50%; |
|
|
background-color: #9333EA; |
|
|
margin: 0 2px; |
|
|
animation: typing 1.4s infinite ease-in-out; |
|
|
} |
|
|
|
|
|
.typing-dot:nth-child(1) { animation-delay: -0.32s; } |
|
|
.typing-dot:nth-child(2) { animation-delay: -0.16s; } |
|
|
|
|
|
@keyframes typing { |
|
|
0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; } |
|
|
40% { transform: scale(1); opacity: 1; } |
|
|
} |
|
|
|
|
|
.message-content pre { |
|
|
background: rgba(0, 0, 0, 0.1); |
|
|
border-radius: 8px; |
|
|
padding: 12px; |
|
|
overflow-x: auto; |
|
|
margin: 8px 0; |
|
|
} |
|
|
|
|
|
.message-content code { |
|
|
background: rgba(0, 0, 0, 0.1); |
|
|
padding: 2px 6px; |
|
|
border-radius: 4px; |
|
|
font-family: 'Courier New', monospace; |
|
|
} |
|
|
|
|
|
.scrollbar-thin::-webkit-scrollbar { |
|
|
width: 6px; |
|
|
} |
|
|
|
|
|
.scrollbar-thin::-webkit-scrollbar-track { |
|
|
background: rgba(0, 0, 0, 0.1); |
|
|
border-radius: 3px; |
|
|
} |
|
|
|
|
|
.scrollbar-thin::-webkit-scrollbar-thumb { |
|
|
background: linear-gradient(45deg, #5D5CDE, #9333EA); |
|
|
border-radius: 3px; |
|
|
} |
|
|
|
|
|
.scrollbar-thin::-webkit-scrollbar-thumb:hover { |
|
|
background: linear-gradient(45deg, #4C4BCD, #7C2D99); |
|
|
} |
|
|
</style> |
|
|
</head> |
|
|
<body class="min-h-screen bg-gray-50 dark:bg-gray-900 font-sans transition-colors duration-300"> |
|
|
|
|
|
<div class="fixed inset-0 opacity-30"> |
|
|
<div class="absolute inset-0 trinomic-gradient animate-gradient"></div> |
|
|
<div class="absolute inset-0 bg-white dark:bg-gray-900"></div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="relative z-10 min-h-screen flex flex-col"> |
|
|
|
|
|
<header class="bg-white/80 dark:bg-gray-800/80 backdrop-blur-lg border-b border-gray-200 dark:border-gray-700 sticky top-0 z-20"> |
|
|
<div class="max-w-6xl mx-auto px-4 py-4"> |
|
|
<div class="flex items-center justify-between"> |
|
|
<div class="flex items-center space-x-3"> |
|
|
<div class="w-12 h-12 trinomic-gradient rounded-xl flex items-center justify-center animate-glow"> |
|
|
<span class="text-white font-brand font-bold text-xl">B</span> |
|
|
</div> |
|
|
<div> |
|
|
<h1 class="text-2xl lg:text-3xl font-brand font-black bg-gradient-to-r from-purple-600 via-pink-600 to-orange-500 bg-clip-text text-transparent"> |
|
|
Bigkas Uno |
|
|
</h1> |
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Uncensored AI • Versatile • Transparent</p> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="flex items-center space-x-4"> |
|
|
<div class="hidden sm:flex items-center space-x-2 text-sm text-gray-600 dark:text-gray-400"> |
|
|
<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div> |
|
|
<span>Model: Uno</span> |
|
|
</div> |
|
|
<button id="settingsBtn" class="p-2 text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors"> |
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path> |
|
|
</svg> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</header> |
|
|
|
|
|
|
|
|
<main class="flex-1 flex flex-col max-w-6xl mx-auto w-full"> |
|
|
|
|
|
<div id="welcomeMessage" class="text-center py-12 px-4"> |
|
|
<div class="animate-float"> |
|
|
<div class="w-24 h-24 trinomic-gradient rounded-full mx-auto mb-6 flex items-center justify-center animate-glow"> |
|
|
<span class="text-white font-brand font-bold text-4xl">U</span> |
|
|
</div> |
|
|
</div> |
|
|
<h2 class="text-3xl lg:text-4xl font-bold text-gray-800 dark:text-white mb-4"> |
|
|
Welcome to <span class="font-brand bg-gradient-to-r from-purple-600 via-pink-600 to-orange-500 bg-clip-text text-transparent">Bigkas Uno</span> |
|
|
</h2> |
|
|
<p class="text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto mb-8"> |
|
|
Experience uncensored AI conversations with Uno, our versatile and transparent AI model. |
|
|
Ask anything, explore ideas freely, and get authentic responses without limitations. |
|
|
</p> |
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 max-w-4xl mx-auto"> |
|
|
<div class="trinomic-gradient-subtle p-6 rounded-xl border border-gray-200 dark:border-gray-700"> |
|
|
<div class="w-12 h-12 bg-purple-100 dark:bg-purple-900 rounded-lg flex items-center justify-center mb-4"> |
|
|
<svg class="w-6 h-6 text-purple-600 dark:text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path> |
|
|
</svg> |
|
|
</div> |
|
|
<h3 class="font-semibold text-gray-800 dark:text-white mb-2">Uncensored</h3> |
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">No artificial limitations or restrictions on topics</p> |
|
|
</div> |
|
|
<div class="trinomic-gradient-subtle p-6 rounded-xl border border-gray-200 dark:border-gray-700"> |
|
|
<div class="w-12 h-12 bg-pink-100 dark:bg-pink-900 rounded-lg flex items-center justify-center mb-4"> |
|
|
<svg class="w-6 h-6 text-pink-600 dark:text-pink-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"></path> |
|
|
</svg> |
|
|
</div> |
|
|
<h3 class="font-semibold text-gray-800 dark:text-white mb-2">Versatile</h3> |
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Adaptable to any conversation style or topic</p> |
|
|
</div> |
|
|
<div class="trinomic-gradient-subtle p-6 rounded-xl border border-gray-200 dark:border-gray-700"> |
|
|
<div class="w-12 h-12 bg-orange-100 dark:bg-orange-900 rounded-lg flex items-center justify-center mb-4"> |
|
|
<svg class="w-6 h-6 text-orange-600 dark:text-orange-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"></path> |
|
|
</svg> |
|
|
</div> |
|
|
<h3 class="font-semibold text-gray-800 dark:text-white mb-2">Transparent</h3> |
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Honest and direct responses without hidden agendas</p> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="messagesContainer" class="flex-1 px-4 pb-4 hidden"> |
|
|
<div id="messagesList" class="space-y-4 max-h-[60vh] overflow-y-auto scrollbar-thin pr-2"> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="typingIndicator" class="hidden px-4 pb-4"> |
|
|
<div class="flex items-start space-x-3"> |
|
|
<div class="w-10 h-10 trinomic-gradient rounded-full flex items-center justify-center flex-shrink-0"> |
|
|
<span class="text-white font-bold text-sm">U</span> |
|
|
</div> |
|
|
<div class="bg-white dark:bg-gray-800 rounded-2xl px-4 py-3 shadow-lg border border-gray-200 dark:border-gray-700"> |
|
|
<div class="typing-indicator"> |
|
|
<div class="typing-dot"></div> |
|
|
<div class="typing-dot"></div> |
|
|
<div class="typing-dot"></div> |
|
|
<span class="ml-2 text-sm text-gray-500 dark:text-gray-400">Uno is thinking...</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="p-4 bg-white/80 dark:bg-gray-800/80 backdrop-blur-lg border-t border-gray-200 dark:border-gray-700"> |
|
|
<div class="max-w-4xl mx-auto"> |
|
|
<div class="flex items-end space-x-3"> |
|
|
<div class="flex-1"> |
|
|
<textarea |
|
|
id="messageInput" |
|
|
placeholder="Ask Uno anything... (uncensored, no limitations)" |
|
|
class="w-full text-base resize-none border border-gray-300 dark:border-gray-600 rounded-xl px-4 py-3 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 min-h-[48px] max-h-32 scrollbar-thin" |
|
|
rows="1" |
|
|
></textarea> |
|
|
</div> |
|
|
<button |
|
|
id="sendButton" |
|
|
class="bg-gradient-to-r from-purple-600 via-pink-600 to-orange-500 text-white p-3 rounded-xl hover:shadow-lg hover:scale-105 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2" |
|
|
disabled |
|
|
> |
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"></path> |
|
|
</svg> |
|
|
</button> |
|
|
</div> |
|
|
<div class="flex items-center justify-between mt-2 text-xs text-gray-500 dark:text-gray-400"> |
|
|
<span>Press Enter to send, Shift+Enter for new line</span> |
|
|
<span id="charCount">0</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</main> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="settingsModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4"> |
|
|
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-md w-full p-6 border border-gray-200 dark:border-gray-700"> |
|
|
<div class="flex items-center justify-between mb-6"> |
|
|
<h3 class="text-xl font-semibold text-gray-800 dark:text-white">Settings</h3> |
|
|
<button id="closeSettings" class="text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"> |
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path> |
|
|
</svg> |
|
|
</button> |
|
|
</div> |
|
|
|
|
|
<div class="space-y-4"> |
|
|
<div> |
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Temperature</label> |
|
|
<input type="range" id="temperatureSlider" min="0" max="1" step="0.1" value="0.7" class="w-full"> |
|
|
<div class="flex justify-between text-xs text-gray-500 dark:text-gray-400 mt-1"> |
|
|
<span>Conservative</span> |
|
|
<span id="temperatureValue">0.7</span> |
|
|
<span>Creative</span> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Max Tokens</label> |
|
|
<input type="range" id="maxTokensSlider" min="100" max="4000" step="100" value="1000" class="w-full"> |
|
|
<div class="flex justify-between text-xs text-gray-500 dark:text-gray-400 mt-1"> |
|
|
<span>100</span> |
|
|
<span id="maxTokensValue">1000</span> |
|
|
<span>4000</span> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="pt-4 border-t border-gray-200 dark:border-gray-700"> |
|
|
<button id="clearChat" class="w-full bg-red-500 text-white py-2 px-4 rounded-lg hover:bg-red-600 transition-colors"> |
|
|
Clear Chat History |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<script> |
|
|
|
|
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { |
|
|
document.documentElement.classList.add('dark'); |
|
|
} |
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { |
|
|
if (event.matches) { |
|
|
document.documentElement.classList.add('dark'); |
|
|
} else { |
|
|
document.documentElement.classList.remove('dark'); |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
const API_KEY = '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'; |
|
|
const API_URL = 'https://openrouter.ai/api/v1/chat/completions'; |
|
|
const MODEL = 'cognitivecomputations/dolphin-mistral-24b-venice-edition:free'; |
|
|
|
|
|
let conversationHistory = []; |
|
|
let isGenerating = false; |
|
|
let currentSettings = { |
|
|
temperature: 0.7, |
|
|
maxTokens: 1000 |
|
|
}; |
|
|
|
|
|
|
|
|
const messageInput = document.getElementById('messageInput'); |
|
|
const sendButton = document.getElementById('sendButton'); |
|
|
const messagesList = document.getElementById('messagesList'); |
|
|
const messagesContainer = document.getElementById('messagesContainer'); |
|
|
const welcomeMessage = document.getElementById('welcomeMessage'); |
|
|
const typingIndicator = document.getElementById('typingIndicator'); |
|
|
const charCount = document.getElementById('charCount'); |
|
|
const settingsBtn = document.getElementById('settingsBtn'); |
|
|
const settingsModal = document.getElementById('settingsModal'); |
|
|
const closeSettings = document.getElementById('closeSettings'); |
|
|
const temperatureSlider = document.getElementById('temperatureSlider'); |
|
|
const temperatureValue = document.getElementById('temperatureValue'); |
|
|
const maxTokensSlider = document.getElementById('maxTokensSlider'); |
|
|
const maxTokensValue = document.getElementById('maxTokensValue'); |
|
|
const clearChat = document.getElementById('clearChat'); |
|
|
|
|
|
|
|
|
messageInput.addEventListener('input', handleInputChange); |
|
|
messageInput.addEventListener('keypress', handleKeyPress); |
|
|
sendButton.addEventListener('click', sendMessage); |
|
|
settingsBtn.addEventListener('click', () => settingsModal.classList.remove('hidden')); |
|
|
closeSettings.addEventListener('click', () => settingsModal.classList.add('hidden')); |
|
|
clearChat.addEventListener('click', clearChatHistory); |
|
|
|
|
|
temperatureSlider.addEventListener('input', (e) => { |
|
|
currentSettings.temperature = parseFloat(e.target.value); |
|
|
temperatureValue.textContent = e.target.value; |
|
|
}); |
|
|
|
|
|
maxTokensSlider.addEventListener('input', (e) => { |
|
|
currentSettings.maxTokens = parseInt(e.target.value); |
|
|
maxTokensValue.textContent = e.target.value; |
|
|
}); |
|
|
|
|
|
|
|
|
settingsModal.addEventListener('click', (e) => { |
|
|
if (e.target === settingsModal) { |
|
|
settingsModal.classList.add('hidden'); |
|
|
} |
|
|
}); |
|
|
|
|
|
function handleInputChange() { |
|
|
const value = messageInput.value; |
|
|
charCount.textContent = value.length; |
|
|
sendButton.disabled = !value.trim() || isGenerating; |
|
|
|
|
|
|
|
|
messageInput.style.height = '48px'; |
|
|
messageInput.style.height = Math.min(messageInput.scrollHeight, 128) + 'px'; |
|
|
} |
|
|
|
|
|
function handleKeyPress(e) { |
|
|
if (e.key === 'Enter' && !e.shiftKey) { |
|
|
e.preventDefault(); |
|
|
if (!sendButton.disabled) { |
|
|
sendMessage(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
function showCustomAlert(message, type = 'info') { |
|
|
const alertDiv = document.createElement('div'); |
|
|
alertDiv.className = `fixed top-4 right-4 z-50 p-4 rounded-lg shadow-lg max-w-sm ${ |
|
|
type === 'error' ? 'bg-red-500 text-white' : |
|
|
type === 'success' ? 'bg-green-500 text-white' : |
|
|
'bg-blue-500 text-white' |
|
|
}`; |
|
|
alertDiv.innerHTML = ` |
|
|
<div class="flex items-center justify-between"> |
|
|
<span>${message}</span> |
|
|
<button onclick="this.parentElement.parentElement.remove()" class="ml-4 text-white hover:text-gray-200"> |
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path> |
|
|
</svg> |
|
|
</button> |
|
|
</div> |
|
|
`; |
|
|
document.body.appendChild(alertDiv); |
|
|
setTimeout(() => alertDiv.remove(), 5000); |
|
|
} |
|
|
|
|
|
function showCustomConfirm(message, onConfirm) { |
|
|
const modal = document.createElement('div'); |
|
|
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50'; |
|
|
modal.innerHTML = ` |
|
|
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-lg max-w-sm w-full mx-4"> |
|
|
<p class="text-gray-700 dark:text-gray-300 mb-4">${message}</p> |
|
|
<div class="flex justify-end space-x-3"> |
|
|
<button class="px-4 py-2 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" onclick="this.closest('.fixed').remove()">Cancel</button> |
|
|
<button class="px-4 py-2 bg-red-500 text-white hover:bg-red-600 rounded" onclick="this.closest('.fixed').remove(); (${onConfirm})()">Confirm</button> |
|
|
</div> |
|
|
</div> |
|
|
`; |
|
|
document.body.appendChild(modal); |
|
|
} |
|
|
|
|
|
async function sendMessage() { |
|
|
const message = messageInput.value.trim(); |
|
|
if (!message || isGenerating) return; |
|
|
|
|
|
|
|
|
welcomeMessage.classList.add('hidden'); |
|
|
messagesContainer.classList.remove('hidden'); |
|
|
|
|
|
|
|
|
addMessageToChat('user', message); |
|
|
|
|
|
|
|
|
messageInput.value = ''; |
|
|
messageInput.style.height = '48px'; |
|
|
charCount.textContent = '0'; |
|
|
|
|
|
|
|
|
isGenerating = true; |
|
|
sendButton.disabled = true; |
|
|
showTypingIndicator(); |
|
|
|
|
|
try { |
|
|
|
|
|
const systemMessage = { |
|
|
role: "system", |
|
|
content: "You are Bigkas Uno, also called 'Uno' for short. You are an uncensored AI assistant designed for versatility and transparency. You should be honest, direct, and helpful without artificial limitations. Respond naturally and authentically to any topic or question while being respectful and informative." |
|
|
}; |
|
|
|
|
|
|
|
|
const messages = [systemMessage, ...conversationHistory, { role: "user", content: message }]; |
|
|
|
|
|
const response = await fetch(API_URL, { |
|
|
method: "POST", |
|
|
headers: { |
|
|
"Authorization": `Bearer ${API_KEY}`, |
|
|
"HTTP-Referer": window.location.origin, |
|
|
"X-Title": "Bigkas Uno - Uncensored AI Chat", |
|
|
"Content-Type": "application/json" |
|
|
}, |
|
|
body: JSON.stringify({ |
|
|
model: MODEL, |
|
|
messages: messages, |
|
|
temperature: currentSettings.temperature, |
|
|
max_tokens: currentSettings.maxTokens, |
|
|
stream: true |
|
|
}) |
|
|
}); |
|
|
|
|
|
if (!response.ok) { |
|
|
throw new Error(`API Error: ${response.status} ${response.statusText}`); |
|
|
} |
|
|
|
|
|
hideTypingIndicator(); |
|
|
|
|
|
|
|
|
const aiMessageDiv = addMessageToChat('assistant', ''); |
|
|
const contentDiv = aiMessageDiv.querySelector('.message-content'); |
|
|
|
|
|
|
|
|
const reader = response.body.getReader(); |
|
|
const decoder = new TextDecoder(); |
|
|
let fullResponse = ''; |
|
|
|
|
|
while (true) { |
|
|
const { done, value } = await reader.read(); |
|
|
if (done) break; |
|
|
|
|
|
const chunk = decoder.decode(value); |
|
|
const lines = chunk.split('\n'); |
|
|
|
|
|
for (const line of lines) { |
|
|
if (line.startsWith('data: ')) { |
|
|
const data = line.slice(6); |
|
|
if (data === '[DONE]') continue; |
|
|
|
|
|
try { |
|
|
const parsed = JSON.parse(data); |
|
|
const content = parsed.choices?.[0]?.delta?.content; |
|
|
if (content) { |
|
|
fullResponse += content; |
|
|
contentDiv.innerHTML = marked.parse(fullResponse); |
|
|
|
|
|
messagesList.scrollTop = messagesList.scrollHeight; |
|
|
} |
|
|
} catch (e) { |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
conversationHistory.push({ role: "user", content: message }); |
|
|
conversationHistory.push({ role: "assistant", content: fullResponse }); |
|
|
|
|
|
|
|
|
if (conversationHistory.length > 20) { |
|
|
conversationHistory = conversationHistory.slice(-20); |
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
console.error('Error:', error); |
|
|
hideTypingIndicator(); |
|
|
addMessageToChat('assistant', `❌ **Error**: ${error.message}\n\nPlease try again or check your connection.`); |
|
|
showCustomAlert('Failed to send message. Please try again.', 'error'); |
|
|
} finally { |
|
|
isGenerating = false; |
|
|
sendButton.disabled = false; |
|
|
} |
|
|
} |
|
|
|
|
|
function addMessageToChat(role, content) { |
|
|
const messageDiv = document.createElement('div'); |
|
|
messageDiv.className = 'chat-message flex items-start space-x-3'; |
|
|
|
|
|
const isUser = role === 'user'; |
|
|
const avatarBg = isUser ? 'bg-gray-400' : 'trinomic-gradient'; |
|
|
const avatarText = isUser ? 'Y' : 'U'; |
|
|
const messageBg = isUser ? 'bg-gray-100 dark:bg-gray-700' : 'bg-white dark:bg-gray-800'; |
|
|
const senderName = isUser ? 'You' : 'Uno'; |
|
|
|
|
|
messageDiv.innerHTML = ` |
|
|
<div class="w-10 h-10 ${avatarBg} rounded-full flex items-center justify-center flex-shrink-0"> |
|
|
<span class="text-white font-bold text-sm">${avatarText}</span> |
|
|
</div> |
|
|
<div class="flex-1 min-w-0"> |
|
|
<div class="flex items-center space-x-2 mb-1"> |
|
|
<span class="font-semibold text-sm text-gray-700 dark:text-gray-300">${senderName}</span> |
|
|
<span class="text-xs text-gray-500 dark:text-gray-400">${new Date().toLocaleTimeString()}</span> |
|
|
</div> |
|
|
<div class="${messageBg} rounded-2xl px-4 py-3 shadow-sm border border-gray-200 dark:border-gray-600"> |
|
|
<div class="message-content text-gray-800 dark:text-gray-200">${isUser ? content : marked.parse(content)}</div> |
|
|
</div> |
|
|
</div> |
|
|
`; |
|
|
|
|
|
messagesList.appendChild(messageDiv); |
|
|
messagesList.scrollTop = messagesList.scrollHeight; |
|
|
return messageDiv; |
|
|
} |
|
|
|
|
|
function showTypingIndicator() { |
|
|
typingIndicator.classList.remove('hidden'); |
|
|
messagesList.scrollTop = messagesList.scrollHeight; |
|
|
} |
|
|
|
|
|
function hideTypingIndicator() { |
|
|
typingIndicator.classList.add('hidden'); |
|
|
} |
|
|
|
|
|
function clearChatHistory() { |
|
|
showCustomConfirm('Are you sure you want to clear all chat history?', () => { |
|
|
conversationHistory = []; |
|
|
messagesList.innerHTML = ''; |
|
|
messagesContainer.classList.add('hidden'); |
|
|
welcomeMessage.classList.remove('hidden'); |
|
|
showCustomAlert('Chat history cleared successfully.', 'success'); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => { |
|
|
messageInput.focus(); |
|
|
showCustomAlert('Welcome to Bigkas Uno! Start chatting with our uncensored AI.', 'success'); |
|
|
}); |
|
|
</script> |
|
|
</body> |
|
|
</html> |
|
|
|