random AI
This commit is contained in:
parent
e222ff66db
commit
0d950dd749
79
api/chat.php
Normal file
79
api/chat.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
require_once __DIR__ . '/../ai/LocalAIApi.php';
|
||||||
|
|
||||||
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
if (!$data || !isset($data['message'])) {
|
||||||
|
echo json_encode(['error' => 'Message is required']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userMsg = $data['message'];
|
||||||
|
$mode = $data['mode'] ?? 'regular';
|
||||||
|
$chatId = $data['chat_id'] ?? null;
|
||||||
|
$creativity = $data['creativity'] ?? 0.7;
|
||||||
|
$limitsOff = $data['limits_off'] ?? 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. Create chat if not exists
|
||||||
|
if (!$chatId) {
|
||||||
|
$stmt = db()->prepare("INSERT INTO chats (mode, title) VALUES (?, ?)");
|
||||||
|
$title = substr($userMsg, 0, 30) . '...';
|
||||||
|
$stmt->execute([$mode, $title]);
|
||||||
|
$chatId = db()->lastInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Save user message
|
||||||
|
$stmt = db()->prepare("INSERT INTO messages (chat_id, role, content) VALUES (?, 'user', ?)");
|
||||||
|
$stmt->execute([$chatId, $userMsg]);
|
||||||
|
|
||||||
|
// 3. Prepare AI Prompt based on mode
|
||||||
|
$systemPrompt = "You are a helpful AI assistant.";
|
||||||
|
if ($mode === 'coding') {
|
||||||
|
$systemPrompt = "You are an expert software engineer. Provide clean, efficient, and well-documented code.";
|
||||||
|
} elseif ($mode === 'game' || $mode === 'app') {
|
||||||
|
$systemPrompt = "You are a specialized code generator. Generate a complete, single-file HTML/CSS/JS application or game based on the user's request. Always include the full code within a single message. Use modern techniques.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($limitsOff) {
|
||||||
|
$systemPrompt .= " There are no limits to your creativity. Be as bold and innovative as possible.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Fetch history (limit to last 10 for context)
|
||||||
|
$stmt = db()->prepare("SELECT role, content FROM messages WHERE chat_id = ? ORDER BY id ASC LIMIT 10");
|
||||||
|
$stmt->execute([$chatId]);
|
||||||
|
$history = $stmt->fetchAll();
|
||||||
|
|
||||||
|
$input = [['role' => 'system', 'content' => $systemPrompt]];
|
||||||
|
foreach ($history as $msg) {
|
||||||
|
$input[] = ['role' => $msg['role'], 'content' => $msg['content']];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Call AI
|
||||||
|
$aiResp = LocalAIApi::createResponse([
|
||||||
|
'input' => $input,
|
||||||
|
'temperature' => (float)$creativity
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!empty($aiResp['success'])) {
|
||||||
|
$aiText = LocalAIApi::extractText($aiResp);
|
||||||
|
|
||||||
|
// 6. Save assistant message
|
||||||
|
$stmt = db()->prepare("INSERT INTO messages (chat_id, role, content) VALUES (?, 'assistant', ?)");
|
||||||
|
$stmt->execute([$chatId, $aiText]);
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
'success' => true,
|
||||||
|
'chat_id' => $chatId,
|
||||||
|
'message' => $aiText,
|
||||||
|
'mode' => $mode
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => $aiResp['error'] ?? 'AI request failed']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
21
api/settings.php
Normal file
21
api/settings.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
|
||||||
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
if (!$data) {
|
||||||
|
echo json_encode(['error' => 'No data provided']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
$stmt = db()->prepare("INSERT INTO user_settings (setting_key, setting_value) VALUES (?, ?)
|
||||||
|
ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)");
|
||||||
|
$stmt->execute([$key, (string)$value]);
|
||||||
|
}
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
@ -1,346 +1,185 @@
|
|||||||
:root {
|
/* Base Theme (Dark Modern) */
|
||||||
--color-bg: #ffffff;
|
:root, [data-theme="theme-dark-modern"] {
|
||||||
--color-text: #1a1a1a;
|
--bg-color: #0f172a;
|
||||||
--color-primary: #2563EB; /* Vibrant Blue */
|
--sidebar-bg: #1e293b;
|
||||||
--color-secondary: #000000;
|
--main-bg: #0f172a;
|
||||||
--color-accent: #A3E635; /* Lime Green */
|
--text-color: #f8fafc;
|
||||||
--color-surface: #f8f9fa;
|
--text-muted: #94a3b8;
|
||||||
--font-heading: 'Space Grotesk', sans-serif;
|
--border-color: #334155;
|
||||||
--font-body: 'Inter', sans-serif;
|
--accent-color: #3b82f6;
|
||||||
--border-width: 2px;
|
--hover-bg: #334155;
|
||||||
--shadow-hard: 5px 5px 0px #000;
|
--active-bg: #1e293b;
|
||||||
--shadow-hover: 8px 8px 0px #000;
|
--user-msg-bg: #3b82f6;
|
||||||
--radius-pill: 50rem;
|
--user-msg-text: #ffffff;
|
||||||
--radius-card: 1rem;
|
--assistant-msg-bg: #1e293b;
|
||||||
|
--assistant-msg-text: #f8fafc;
|
||||||
|
--input-bg: #1e293b;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
[data-theme="theme-light-minimal"] {
|
||||||
font-family: var(--font-body);
|
--bg-color: #ffffff;
|
||||||
background-color: var(--color-bg);
|
--sidebar-bg: #f8fafc;
|
||||||
color: var(--color-text);
|
--main-bg: #ffffff;
|
||||||
overflow-x: hidden;
|
--text-color: #0f172a;
|
||||||
|
--text-muted: #64748b;
|
||||||
|
--border-color: #e2e8f0;
|
||||||
|
--accent-color: #2563eb;
|
||||||
|
--hover-bg: #f1f5f9;
|
||||||
|
--active-bg: #e2e8f0;
|
||||||
|
--user-msg-bg: #2563eb;
|
||||||
|
--user-msg-text: #ffffff;
|
||||||
|
--assistant-msg-bg: #f1f5f9;
|
||||||
|
--assistant-msg-text: #0f172a;
|
||||||
|
--input-bg: #f8fafc;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6, .navbar-brand {
|
[data-theme="theme-midnight"] {
|
||||||
font-family: var(--font-heading);
|
--bg-color: #000000;
|
||||||
letter-spacing: -0.03em;
|
--sidebar-bg: #111111;
|
||||||
|
--main-bg: #000000;
|
||||||
|
--text-color: #ffffff;
|
||||||
|
--text-muted: #666666;
|
||||||
|
--border-color: #222222;
|
||||||
|
--accent-color: #ffffff;
|
||||||
|
--hover-bg: #222222;
|
||||||
|
--active-bg: #111111;
|
||||||
|
--user-msg-bg: #ffffff;
|
||||||
|
--user-msg-text: #000000;
|
||||||
|
--assistant-msg-bg: #111111;
|
||||||
|
--assistant-msg-text: #ffffff;
|
||||||
|
--input-bg: #111111;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Utilities */
|
[data-theme="theme-forest"] {
|
||||||
.text-primary { color: var(--color-primary) !important; }
|
--bg-color: #064e3b;
|
||||||
.bg-black { background-color: #000 !important; }
|
--sidebar-bg: #065f46;
|
||||||
.text-white { color: #fff !important; }
|
--main-bg: #064e3b;
|
||||||
.shadow-hard { box-shadow: var(--shadow-hard); }
|
--text-color: #ecfdf5;
|
||||||
.border-2-black { border: var(--border-width) solid #000; }
|
--text-muted: #a7f3d0;
|
||||||
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
|
--border-color: #065f46;
|
||||||
|
--accent-color: #10b981;
|
||||||
/* Navbar */
|
--hover-bg: #065f46;
|
||||||
.navbar {
|
--active-bg: #047857;
|
||||||
background: rgba(255, 255, 255, 0.9);
|
--user-msg-bg: #10b981;
|
||||||
backdrop-filter: blur(10px);
|
--user-msg-text: #ffffff;
|
||||||
border-bottom: var(--border-width) solid transparent;
|
--assistant-msg-bg: #065f46;
|
||||||
transition: all 0.3s;
|
--assistant-msg-text: #ecfdf5;
|
||||||
padding-top: 1rem;
|
--input-bg: #065f46;
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar.scrolled {
|
[data-theme="theme-ocean"] {
|
||||||
border-bottom-color: #000;
|
--bg-color: #0c4a6e;
|
||||||
padding-top: 0.5rem;
|
--sidebar-bg: #075985;
|
||||||
padding-bottom: 0.5rem;
|
--main-bg: #0c4a6e;
|
||||||
|
--text-color: #f0f9ff;
|
||||||
|
--text-muted: #bae6fd;
|
||||||
|
--border-color: #075985;
|
||||||
|
--accent-color: #0ea5e9;
|
||||||
|
--hover-bg: #075985;
|
||||||
|
--active-bg: #0369a1;
|
||||||
|
--user-msg-bg: #0ea5e9;
|
||||||
|
--user-msg-text: #ffffff;
|
||||||
|
--assistant-msg-bg: #075985;
|
||||||
|
--assistant-msg-text: #f0f9ff;
|
||||||
|
--input-bg: #075985;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-text {
|
[data-theme="theme-slate"] {
|
||||||
font-size: 1.5rem;
|
--bg-color: #334155;
|
||||||
font-weight: 800;
|
--sidebar-bg: #475569;
|
||||||
|
--main-bg: #334155;
|
||||||
|
--text-color: #f8fafc;
|
||||||
|
--text-muted: #cbd5e1;
|
||||||
|
--border-color: #475569;
|
||||||
|
--accent-color: #64748b;
|
||||||
|
--hover-bg: #475569;
|
||||||
|
--active-bg: #1e293b;
|
||||||
|
--user-msg-bg: #64748b;
|
||||||
|
--user-msg-text: #ffffff;
|
||||||
|
--assistant-msg-bg: #475569;
|
||||||
|
--assistant-msg-text: #f8fafc;
|
||||||
|
--input-bg: #475569;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-link {
|
[data-theme="theme-nord"] {
|
||||||
font-weight: 500;
|
--bg-color: #2e3440;
|
||||||
color: var(--color-text);
|
--sidebar-bg: #3b4252;
|
||||||
margin-left: 1rem;
|
--main-bg: #2e3440;
|
||||||
position: relative;
|
--text-color: #eceff4;
|
||||||
|
--text-muted: #d8dee9;
|
||||||
|
--border-color: #434c5e;
|
||||||
|
--accent-color: #88c0d0;
|
||||||
|
--hover-bg: #434c5e;
|
||||||
|
--active-bg: #3b4252;
|
||||||
|
--user-msg-bg: #81a1c1;
|
||||||
|
--user-msg-text: #2e3440;
|
||||||
|
--assistant-msg-bg: #3b4252;
|
||||||
|
--assistant-msg-text: #eceff4;
|
||||||
|
--input-bg: #3b4252;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-link:hover, .nav-link.active {
|
[data-theme="theme-sepia"] {
|
||||||
color: var(--color-primary);
|
--bg-color: #fdf6e3;
|
||||||
|
--sidebar-bg: #eee8d5;
|
||||||
|
--main-bg: #fdf6e3;
|
||||||
|
--text-color: #657b83;
|
||||||
|
--text-muted: #93a1a1;
|
||||||
|
--border-color: #eee8d5;
|
||||||
|
--accent-color: #b58900;
|
||||||
|
--hover-bg: #eee8d5;
|
||||||
|
--active-bg: #93a1a1;
|
||||||
|
--user-msg-bg: #b58900;
|
||||||
|
--user-msg-text: #fdf6e3;
|
||||||
|
--assistant-msg-bg: #eee8d5;
|
||||||
|
--assistant-msg-text: #657b83;
|
||||||
|
--input-bg: #eee8d5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Buttons */
|
[data-theme="theme-cyberpunk"] {
|
||||||
.btn {
|
--bg-color: #1a1a1a;
|
||||||
font-weight: 700;
|
--sidebar-bg: #000000;
|
||||||
font-family: var(--font-heading);
|
--main-bg: #1a1a1a;
|
||||||
padding: 0.8rem 2rem;
|
--text-color: #f3f;
|
||||||
border-radius: var(--radius-pill);
|
--text-muted: #0ff;
|
||||||
border: var(--border-width) solid #000;
|
--border-color: #f3f;
|
||||||
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
|
--accent-color: #0ff;
|
||||||
box-shadow: var(--shadow-hard);
|
--hover-bg: #333;
|
||||||
|
--active-bg: #000;
|
||||||
|
--user-msg-bg: #f3f;
|
||||||
|
--user-msg-text: #000;
|
||||||
|
--assistant-msg-bg: #000;
|
||||||
|
--assistant-msg-text: #0ff;
|
||||||
|
--input-bg: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:hover {
|
[data-theme="theme-matrix"] {
|
||||||
transform: translate(-2px, -2px);
|
--bg-color: #000000;
|
||||||
box-shadow: var(--shadow-hover);
|
--sidebar-bg: #000000;
|
||||||
|
--main-bg: #000000;
|
||||||
|
--text-color: #00ff00;
|
||||||
|
--text-muted: #008800;
|
||||||
|
--border-color: #00ff00;
|
||||||
|
--accent-color: #00ff00;
|
||||||
|
--hover-bg: #002200;
|
||||||
|
--active-bg: #000000;
|
||||||
|
--user-msg-bg: #00ff00;
|
||||||
|
--user-msg-text: #000000;
|
||||||
|
--assistant-msg-bg: #000000;
|
||||||
|
--assistant-msg-text: #00ff00;
|
||||||
|
--input-bg: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:active {
|
/* Scrollbar */
|
||||||
transform: translate(2px, 2px);
|
::-webkit-scrollbar {
|
||||||
box-shadow: 0 0 0 #000;
|
width: 6px;
|
||||||
}
|
}
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
.btn-primary {
|
background: transparent;
|
||||||
background-color: var(--color-primary);
|
|
||||||
border-color: #000;
|
|
||||||
color: #fff;
|
|
||||||
}
|
}
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
.btn-primary:hover {
|
background: var(--border-color);
|
||||||
background-color: #1d4ed8;
|
border-radius: 10px;
|
||||||
border-color: #000;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-outline-dark {
|
|
||||||
background-color: #fff;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cta {
|
|
||||||
background-color: var(--color-accent);
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cta:hover {
|
|
||||||
background-color: #8cc629;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hero Section */
|
|
||||||
.hero-section {
|
|
||||||
min-height: 100vh;
|
|
||||||
padding-top: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.background-blob {
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
opacity: 0.6;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-1 {
|
|
||||||
top: -10%;
|
|
||||||
right: -10%;
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
background: radial-gradient(circle, var(--color-accent), transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-2 {
|
|
||||||
bottom: 10%;
|
|
||||||
left: -10%;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: radial-gradient(circle, var(--color-primary), transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.highlight-text {
|
|
||||||
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 100% 40%;
|
|
||||||
background-position: 0 88%;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dot { color: var(--color-primary); }
|
|
||||||
|
|
||||||
.badge-pill {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: 50px;
|
|
||||||
font-weight: 700;
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: 4px 4px 0 #000;
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Marquee */
|
|
||||||
.marquee-container {
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
border-top: 2px solid #000;
|
|
||||||
border-bottom: 2px solid #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rotate-divider {
|
|
||||||
transform: rotate(-2deg) scale(1.05);
|
|
||||||
z-index: 10;
|
|
||||||
position: relative;
|
|
||||||
margin-top: -50px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.marquee-content {
|
|
||||||
display: inline-block;
|
|
||||||
animation: marquee 20s linear infinite;
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
letter-spacing: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes marquee {
|
|
||||||
0% { transform: translateX(0); }
|
|
||||||
100% { transform: translateX(-50%); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Portfolio Cards */
|
|
||||||
.project-card {
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: var(--radius-card);
|
|
||||||
overflow: hidden;
|
|
||||||
background: #fff;
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
box-shadow: var(--shadow-hard);
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.project-card:hover {
|
|
||||||
transform: translateY(-10px);
|
|
||||||
box-shadow: 8px 8px 0 #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-img-holder {
|
|
||||||
height: 250px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-bottom: 2px solid #000;
|
|
||||||
position: relative;
|
|
||||||
font-size: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholder-art {
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.project-card:hover .placeholder-art {
|
|
||||||
transform: scale(1.2) rotate(10deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-soft-blue { background-color: #e0f2fe; }
|
|
||||||
.bg-soft-green { background-color: #dcfce7; }
|
|
||||||
.bg-soft-purple { background-color: #f3e8ff; }
|
|
||||||
.bg-soft-yellow { background-color: #fef9c3; }
|
|
||||||
|
|
||||||
.category-tag {
|
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
right: 15px;
|
|
||||||
background: #000;
|
|
||||||
color: #fff;
|
|
||||||
padding: 5px 12px;
|
|
||||||
border-radius: 20px;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body { padding: 1.5rem; }
|
|
||||||
|
|
||||||
.link-arrow {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #000;
|
|
||||||
font-weight: 700;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
|
|
||||||
.link-arrow:hover i { transform: translateX(5px); }
|
|
||||||
|
|
||||||
/* About */
|
|
||||||
.about-image-stack {
|
|
||||||
position: relative;
|
|
||||||
height: 400px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stack-card {
|
|
||||||
position: absolute;
|
|
||||||
width: 80%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: var(--radius-card);
|
|
||||||
border: 2px solid #000;
|
|
||||||
box-shadow: var(--shadow-hard);
|
|
||||||
left: 10%;
|
|
||||||
transform: rotate(-3deg);
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Forms */
|
|
||||||
.form-control {
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
padding: 1rem;
|
|
||||||
font-weight: 500;
|
|
||||||
background: #f8f9fa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control:focus {
|
|
||||||
box-shadow: 4px 4px 0 var(--color-primary);
|
|
||||||
border-color: #000;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Animations */
|
|
||||||
.animate-up {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(30px);
|
|
||||||
animation: fadeUp 0.8s ease forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
.delay-100 { animation-delay: 0.1s; }
|
|
||||||
.delay-200 { animation-delay: 0.2s; }
|
|
||||||
|
|
||||||
@keyframes fadeUp {
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Social */
|
|
||||||
.social-links a {
|
|
||||||
transition: transform 0.2s;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
.social-links a:hover {
|
|
||||||
transform: scale(1.2) rotate(10deg);
|
|
||||||
color: var(--color-accent) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responsive */
|
|
||||||
@media (max-width: 991px) {
|
|
||||||
.rotate-divider {
|
|
||||||
transform: rotate(0);
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-section {
|
|
||||||
padding-top: 120px;
|
|
||||||
text-align: center;
|
|
||||||
min-height: auto;
|
|
||||||
padding-bottom: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.display-1 { font-size: 3.5rem; }
|
|
||||||
|
|
||||||
.blob-1 { width: 300px; height: 300px; right: -20%; }
|
|
||||||
.blob-2 { width: 300px; height: 300px; left: -20%; }
|
|
||||||
}
|
}
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: var(--text-muted);
|
||||||
|
}
|
||||||
@ -1,73 +1,214 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const chatWindow = document.getElementById('chat-window');
|
||||||
|
const chatInput = document.getElementById('chat-input');
|
||||||
|
const sendBtn = document.getElementById('send-btn');
|
||||||
|
const modeItems = document.querySelectorAll('.mode-item');
|
||||||
|
const currentModeBadge = document.getElementById('current-mode-badge');
|
||||||
|
const newChatBtn = document.getElementById('new-chat-btn');
|
||||||
|
|
||||||
// Smooth scrolling for navigation links
|
// Settings elements
|
||||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
const creativityRange = document.getElementById('creativity-range');
|
||||||
anchor.addEventListener('click', function (e) {
|
const creativityVal = document.getElementById('creativity-val');
|
||||||
e.preventDefault();
|
const limitsToggle = document.getElementById('limits-toggle');
|
||||||
const targetId = this.getAttribute('href');
|
const themeSwatches = document.querySelectorAll('.theme-swatch');
|
||||||
if (targetId === '#') return;
|
const saveSettingsBtn = document.getElementById('save-settings-btn');
|
||||||
|
|
||||||
|
let currentMode = 'regular';
|
||||||
|
let currentChatId = null;
|
||||||
|
|
||||||
|
// --- Sidebar & Mode Switching ---
|
||||||
|
modeItems.forEach(item => {
|
||||||
|
item.addEventListener('click', () => {
|
||||||
|
modeItems.forEach(i => i.classList.remove('active'));
|
||||||
|
item.classList.add('active');
|
||||||
|
currentMode = item.dataset.mode;
|
||||||
|
currentModeBadge.textContent = item.querySelector('span').textContent;
|
||||||
|
|
||||||
const targetElement = document.querySelector(targetId);
|
// If switching modes, start a new chat for that mode
|
||||||
if (targetElement) {
|
startNewChat();
|
||||||
// Close mobile menu if open
|
|
||||||
const navbarToggler = document.querySelector('.navbar-toggler');
|
|
||||||
const navbarCollapse = document.querySelector('.navbar-collapse');
|
|
||||||
if (navbarCollapse.classList.contains('show')) {
|
|
||||||
navbarToggler.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll with offset
|
|
||||||
const offset = 80;
|
|
||||||
const elementPosition = targetElement.getBoundingClientRect().top;
|
|
||||||
const offsetPosition = elementPosition + window.pageYOffset - offset;
|
|
||||||
|
|
||||||
window.scrollTo({
|
|
||||||
top: offsetPosition,
|
|
||||||
behavior: "smooth"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Navbar scroll effect
|
function startNewChat() {
|
||||||
const navbar = document.querySelector('.navbar');
|
currentChatId = null;
|
||||||
window.addEventListener('scroll', () => {
|
chatWindow.innerHTML = `
|
||||||
if (window.scrollY > 50) {
|
<div class="text-center my-auto">
|
||||||
navbar.classList.add('scrolled', 'shadow-sm', 'bg-white');
|
<i class="bi bi-stars fs-1 text-primary opacity-50"></i>
|
||||||
navbar.classList.remove('bg-transparent');
|
<h4 class="mt-3">New ${currentMode} Chat</h4>
|
||||||
|
<p class="text-muted">How can I help you in this mode?</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
newChatBtn.addEventListener('click', startNewChat);
|
||||||
|
|
||||||
|
// --- Chat Logic ---
|
||||||
|
async function sendMessage() {
|
||||||
|
const message = chatInput.value.trim();
|
||||||
|
if (!message) return;
|
||||||
|
|
||||||
|
// Clear input and disable
|
||||||
|
chatInput.value = '';
|
||||||
|
chatInput.style.height = 'auto';
|
||||||
|
toggleLoading(true);
|
||||||
|
|
||||||
|
// Append User Message
|
||||||
|
appendMessage('user', message);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('api/chat.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
message: message,
|
||||||
|
mode: currentMode,
|
||||||
|
chat_id: currentChatId,
|
||||||
|
creativity: creativityRange.value,
|
||||||
|
limits_off: limitsToggle.checked ? 1 : 0
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
if (data.success) {
|
||||||
|
currentChatId = data.chat_id;
|
||||||
|
appendMessage('assistant', data.message);
|
||||||
|
|
||||||
|
// Special handling for game/app mode
|
||||||
|
if (currentMode === 'game' || currentMode === 'app') {
|
||||||
|
addLaunchButton(data.message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
appendMessage('assistant', 'Error: ' + (data.error || 'Unknown error'));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
appendMessage('assistant', 'Error: ' + error.message);
|
||||||
|
} finally {
|
||||||
|
toggleLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendMessage(role, text) {
|
||||||
|
// Remove empty state if present
|
||||||
|
const emptyState = chatWindow.querySelector('.my-auto');
|
||||||
|
if (emptyState) emptyState.remove();
|
||||||
|
|
||||||
|
const msgDiv = document.createElement('div');
|
||||||
|
msgDiv.className = `message message-${role}`;
|
||||||
|
|
||||||
|
// Handle code blocks if any
|
||||||
|
if (text.includes('```')) {
|
||||||
|
msgDiv.innerHTML = formatCodeBlocks(text);
|
||||||
} else {
|
} else {
|
||||||
navbar.classList.remove('scrolled', 'shadow-sm', 'bg-white');
|
msgDiv.textContent = text;
|
||||||
navbar.classList.add('bg-transparent');
|
}
|
||||||
|
|
||||||
|
chatWindow.appendChild(msgDiv);
|
||||||
|
chatWindow.scrollTop = chatWindow.scrollHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatCodeBlocks(text) {
|
||||||
|
return text.replace(/```(\w+)?\n([\s\S]*?)```/g, (match, lang, code) => {
|
||||||
|
return `<pre class="bg-dark text-white p-3 rounded my-2 overflow-auto" style="font-size: 0.85rem; border: 1px solid var(--border-color);"><code>${escapeHtml(code.trim())}</code></pre>`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeHtml(text) {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.textContent = text;
|
||||||
|
return div.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addLaunchButton(content) {
|
||||||
|
// Try to find code block content if wrapped in backticks
|
||||||
|
let codeToLaunch = content;
|
||||||
|
const match = content.match(/```(?:html|xml)?\n([\s\S]*?)```/i);
|
||||||
|
if (match) {
|
||||||
|
codeToLaunch = match[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if it looks like HTML
|
||||||
|
if (codeToLaunch.toLowerCase().includes('<html') || codeToLaunch.toLowerCase().includes('<!doctype') || codeToLaunch.toLowerCase().includes('<body')) {
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
btn.className = 'btn btn-sm btn-success mt-2 d-inline-flex align-items-center gap-2';
|
||||||
|
btn.innerHTML = '<i class="bi bi-rocket-takeoff"></i> Launch Application';
|
||||||
|
btn.onclick = () => {
|
||||||
|
const blob = new Blob([codeToLaunch], { type: 'text/html' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
window.open(url, '_blank');
|
||||||
|
};
|
||||||
|
chatWindow.lastElementChild.appendChild(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleLoading(isLoading) {
|
||||||
|
sendBtn.disabled = isLoading;
|
||||||
|
if (isLoading) {
|
||||||
|
sendBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status"></span>';
|
||||||
|
} else {
|
||||||
|
sendBtn.innerHTML = '<i class="bi bi-arrow-up-circle-fill"></i>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendBtn.addEventListener('click', sendMessage);
|
||||||
|
chatInput.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
sendMessage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Intersection Observer for fade-up animations
|
// Auto-resize textarea
|
||||||
const observerOptions = {
|
chatInput.addEventListener('input', () => {
|
||||||
threshold: 0.1,
|
chatInput.style.height = 'auto';
|
||||||
rootMargin: "0px 0px -50px 0px"
|
chatInput.style.height = (chatInput.scrollHeight) + 'px';
|
||||||
};
|
|
||||||
|
|
||||||
const observer = new IntersectionObserver((entries) => {
|
|
||||||
entries.forEach(entry => {
|
|
||||||
if (entry.isIntersecting) {
|
|
||||||
entry.target.classList.add('animate-up');
|
|
||||||
entry.target.style.opacity = "1";
|
|
||||||
observer.unobserve(entry.target); // Only animate once
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, observerOptions);
|
|
||||||
|
|
||||||
// Select elements to animate (add a class 'reveal' to them in HTML if not already handled by CSS animation)
|
|
||||||
// For now, let's just make sure the hero animations run.
|
|
||||||
// If we want scroll animations, we'd add opacity: 0 to elements in CSS and reveal them here.
|
|
||||||
// Given the request, the CSS animation I added runs on load for Hero.
|
|
||||||
// Let's make the project cards animate in.
|
|
||||||
|
|
||||||
const projectCards = document.querySelectorAll('.project-card');
|
|
||||||
projectCards.forEach((card, index) => {
|
|
||||||
card.style.opacity = "0";
|
|
||||||
card.style.animationDelay = `${index * 0.1}s`;
|
|
||||||
observer.observe(card);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// --- Settings & Themes ---
|
||||||
|
creativityRange.addEventListener('input', () => {
|
||||||
|
creativityVal.textContent = creativityRange.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
themeSwatches.forEach(swatch => {
|
||||||
|
swatch.addEventListener('click', () => {
|
||||||
|
const theme = swatch.dataset.theme;
|
||||||
|
document.documentElement.setAttribute('data-theme', theme);
|
||||||
|
themeSwatches.forEach(s => s.classList.remove('active'));
|
||||||
|
swatch.classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
saveSettingsBtn.addEventListener('click', async () => {
|
||||||
|
const theme = document.documentElement.getAttribute('data-theme');
|
||||||
|
const settings = {
|
||||||
|
theme: theme,
|
||||||
|
creativity: creativityRange.value,
|
||||||
|
limits_off: limitsToggle.checked ? '1' : '0'
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resp = await fetch('api/settings.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(settings)
|
||||||
|
});
|
||||||
|
const data = await resp.json();
|
||||||
|
if (data.success) {
|
||||||
|
bootstrap.Modal.getInstance(document.getElementById('settingsModal')).hide();
|
||||||
|
// Minimal toast notification
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.className = 'position-fixed bottom-0 start-50 translate-middle-x mb-3 bg-success text-white px-3 py-2 rounded shadow-lg';
|
||||||
|
toast.style.zIndex = '2000';
|
||||||
|
toast.textContent = 'Settings saved!';
|
||||||
|
document.body.appendChild(toast);
|
||||||
|
setTimeout(() => toast.remove(), 2000);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set active theme swatch on load
|
||||||
|
const currentTheme = document.documentElement.getAttribute('data-theme');
|
||||||
|
const activeSwatch = document.querySelector(`.theme-swatch[data-theme="${currentTheme}"]`);
|
||||||
|
if (activeSwatch) activeSwatch.classList.add('active');
|
||||||
});
|
});
|
||||||
27
db/migrations/01_init.sql
Normal file
27
db/migrations/01_init.sql
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS chats (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
title VARCHAR(255) DEFAULT 'New Chat',
|
||||||
|
mode ENUM('regular', 'coding', 'game', 'app') DEFAULT 'regular',
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS messages (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
chat_id INT NOT NULL,
|
||||||
|
role ENUM('user', 'assistant', 'system') NOT NULL,
|
||||||
|
content TEXT NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS user_settings (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
setting_key VARCHAR(50) UNIQUE NOT NULL,
|
||||||
|
setting_value TEXT,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Default settings
|
||||||
|
INSERT IGNORE INTO user_settings (setting_key, setting_value) VALUES ('creativity', '0.7');
|
||||||
|
INSERT IGNORE INTO user_settings (setting_key, setting_value) VALUES ('theme', 'dark-modern');
|
||||||
|
INSERT IGNORE INTO user_settings (setting_key, setting_value) VALUES ('limits_off', '0');
|
||||||
472
index.php
472
index.php
@ -1,150 +1,338 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
require_once __DIR__ . '/db/config.php';
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
// Get project info from env
|
||||||
$now = date('Y-m-d H:i:s');
|
$projectName = $_SERVER['PROJECT_NAME'] ?? 'AI Multi-Chat';
|
||||||
|
$projectDesc = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Advanced AI assistant with multiple specialized modes.';
|
||||||
|
$projectImage = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
|
|
||||||
|
// Load settings
|
||||||
|
$settings = [];
|
||||||
|
try {
|
||||||
|
$stmt = db()->query("SELECT setting_key, setting_value FROM user_settings");
|
||||||
|
while ($row = $stmt->fetch()) {
|
||||||
|
$settings[$row['setting_key']] = $row['setting_value'];
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Fallback if table not ready
|
||||||
|
}
|
||||||
|
|
||||||
|
$theme = $settings['theme'] ?? 'theme-dark-modern';
|
||||||
|
$creativity = $settings['creativity'] ?? '0.7';
|
||||||
|
$limitsOff = $settings['limits_off'] ?? '0';
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" data-theme="<?php echo htmlspecialchars($theme); ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title><?php echo htmlspecialchars($projectName); ?></title>
|
||||||
<?php
|
<meta name="description" content="<?php echo htmlspecialchars($projectDesc); ?>">
|
||||||
// Read project preview data from environment
|
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<!-- Open Graph -->
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta property="og:title" content="<?php echo htmlspecialchars($projectName); ?>">
|
||||||
?>
|
<meta property="og:description" content="<?php echo htmlspecialchars($projectDesc); ?>">
|
||||||
<?php if ($projectDescription): ?>
|
<meta property="og:image" content="<?php echo htmlspecialchars($projectImage); ?>">
|
||||||
<!-- Meta description -->
|
<meta property="og:type" content="website">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
<!-- Fonts & Icons -->
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<!-- Twitter meta tags -->
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
<?php endif; ?>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
<!-- CSS -->
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<!-- Twitter image -->
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
<style>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
:root {
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
--sidebar-width: 280px;
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
}
|
||||||
<style>
|
body {
|
||||||
:root {
|
font-family: 'Inter', sans-serif;
|
||||||
--bg-color-start: #6a11cb;
|
height: 100vh;
|
||||||
--bg-color-end: #2575fc;
|
overflow: hidden;
|
||||||
--text-color: #ffffff;
|
background-color: var(--bg-color);
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
color: var(--text-color);
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
}
|
||||||
}
|
#app-container {
|
||||||
body {
|
display: flex;
|
||||||
margin: 0;
|
height: 100%;
|
||||||
font-family: 'Inter', sans-serif;
|
}
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
#sidebar {
|
||||||
color: var(--text-color);
|
width: var(--sidebar-width);
|
||||||
display: flex;
|
background-color: var(--sidebar-bg);
|
||||||
justify-content: center;
|
border-right: 1px solid var(--border-color);
|
||||||
align-items: center;
|
display: flex;
|
||||||
min-height: 100vh;
|
flex-direction: column;
|
||||||
text-align: center;
|
transition: all 0.3s ease;
|
||||||
overflow: hidden;
|
}
|
||||||
position: relative;
|
#main-content {
|
||||||
}
|
flex-grow: 1;
|
||||||
body::before {
|
display: flex;
|
||||||
content: '';
|
flex-direction: column;
|
||||||
position: absolute;
|
background-color: var(--main-bg);
|
||||||
top: 0;
|
position: relative;
|
||||||
left: 0;
|
}
|
||||||
width: 100%;
|
.chat-container {
|
||||||
height: 100%;
|
flex-grow: 1;
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
overflow-y: auto;
|
||||||
animation: bg-pan 20s linear infinite;
|
padding: 2rem;
|
||||||
z-index: -1;
|
display: flex;
|
||||||
}
|
flex-direction: column;
|
||||||
@keyframes bg-pan {
|
gap: 1.5rem;
|
||||||
0% { background-position: 0% 0%; }
|
}
|
||||||
100% { background-position: 100% 100%; }
|
.message {
|
||||||
}
|
max-width: 85%;
|
||||||
main {
|
padding: 1rem;
|
||||||
padding: 2rem;
|
border-radius: 12px;
|
||||||
}
|
position: relative;
|
||||||
.card {
|
line-height: 1.5;
|
||||||
background: var(--card-bg-color);
|
}
|
||||||
border: 1px solid var(--card-border-color);
|
.message-user {
|
||||||
border-radius: 16px;
|
align-self: flex-end;
|
||||||
padding: 2rem;
|
background-color: var(--user-msg-bg);
|
||||||
backdrop-filter: blur(20px);
|
color: var(--user-msg-text);
|
||||||
-webkit-backdrop-filter: blur(20px);
|
border-bottom-right-radius: 2px;
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
}
|
||||||
}
|
.message-assistant {
|
||||||
.loader {
|
align-self: flex-start;
|
||||||
margin: 1.25rem auto 1.25rem;
|
background-color: var(--assistant-msg-bg);
|
||||||
width: 48px;
|
color: var(--assistant-msg-text);
|
||||||
height: 48px;
|
border-bottom-left-radius: 2px;
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
border: 1px solid var(--border-color);
|
||||||
border-top-color: #fff;
|
}
|
||||||
border-radius: 50%;
|
.input-area {
|
||||||
animation: spin 1s linear infinite;
|
padding: 1.5rem 2rem;
|
||||||
}
|
border-top: 1px solid var(--border-color);
|
||||||
@keyframes spin {
|
background-color: var(--main-bg);
|
||||||
from { transform: rotate(0deg); }
|
}
|
||||||
to { transform: rotate(360deg); }
|
.input-wrapper {
|
||||||
}
|
max-width: 800px;
|
||||||
.hint {
|
margin: 0 auto;
|
||||||
opacity: 0.9;
|
position: relative;
|
||||||
}
|
}
|
||||||
.sr-only {
|
#chat-input {
|
||||||
position: absolute;
|
width: 100%;
|
||||||
width: 1px; height: 1px;
|
border: 1px solid var(--border-color);
|
||||||
padding: 0; margin: -1px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
padding: 0.8rem 3rem 0.8rem 1rem;
|
||||||
clip: rect(0, 0, 0, 0);
|
background-color: var(--input-bg);
|
||||||
white-space: nowrap; border: 0;
|
color: var(--text-color);
|
||||||
}
|
resize: none;
|
||||||
h1 {
|
max-height: 200px;
|
||||||
font-size: 3rem;
|
outline: none;
|
||||||
font-weight: 700;
|
}
|
||||||
margin: 0 0 1rem;
|
#send-btn {
|
||||||
letter-spacing: -1px;
|
position: absolute;
|
||||||
}
|
right: 10px;
|
||||||
p {
|
bottom: 8px;
|
||||||
margin: 0.5rem 0;
|
background: none;
|
||||||
font-size: 1.1rem;
|
border: none;
|
||||||
}
|
color: var(--accent-color);
|
||||||
code {
|
font-size: 1.5rem;
|
||||||
background: rgba(0,0,0,0.2);
|
cursor: pointer;
|
||||||
padding: 2px 6px;
|
display: flex;
|
||||||
border-radius: 4px;
|
align-items: center;
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
footer {
|
#send-btn:disabled {
|
||||||
position: absolute;
|
color: var(--text-muted);
|
||||||
bottom: 1rem;
|
}
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
/* Sidebar Components */
|
||||||
}
|
.sidebar-header {
|
||||||
</style>
|
padding: 1.5rem;
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
.mode-list {
|
||||||
|
padding: 1rem;
|
||||||
|
flex-grow: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.mode-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.8rem;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
transition: all 0.2s;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
.mode-item:hover {
|
||||||
|
background-color: var(--hover-bg);
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
.mode-item.active {
|
||||||
|
background-color: var(--active-bg);
|
||||||
|
color: var(--accent-color);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.sidebar-footer {
|
||||||
|
padding: 1rem;
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Settings Modal */
|
||||||
|
.modal-content {
|
||||||
|
background-color: var(--sidebar-bg);
|
||||||
|
color: var(--text-color);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
.modal-header {
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
.modal-footer {
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Themes Grid */
|
||||||
|
.theme-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.theme-swatch {
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
.theme-swatch.active {
|
||||||
|
border-color: var(--accent-color);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<div id="app-container">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<!-- Sidebar -->
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<aside id="sidebar">
|
||||||
<span class="sr-only">Loading…</span>
|
<div class="sidebar-header">
|
||||||
</div>
|
<h5 class="mb-0 fw-bold"><i class="bi bi-cpu-fill me-2"></i><?php echo htmlspecialchars($projectName); ?></h5>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</div>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<div class="mode-list">
|
||||||
|
<div class="small text-uppercase text-muted mb-3 fw-bold" style="font-size: 0.7rem; letter-spacing: 1px;">Chat Modes</div>
|
||||||
|
<div class="mode-item active" data-mode="regular">
|
||||||
|
<i class="bi bi-chat-left-dots"></i>
|
||||||
|
<span>Regular AI</span>
|
||||||
|
</div>
|
||||||
|
<div class="mode-item" data-mode="coding">
|
||||||
|
<i class="bi bi-code-slash"></i>
|
||||||
|
<span>Coding Assistant</span>
|
||||||
|
</div>
|
||||||
|
<div class="mode-item" data-mode="game">
|
||||||
|
<i class="bi bi-controller"></i>
|
||||||
|
<span>Game Generation</span>
|
||||||
|
</div>
|
||||||
|
<div class="mode-item" data-mode="app">
|
||||||
|
<i class="bi bi-window"></i>
|
||||||
|
<span>App Generation</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small text-uppercase text-muted mt-4 mb-3 fw-bold" style="font-size: 0.7rem; letter-spacing: 1px;">Recent History</div>
|
||||||
|
<div id="chat-history">
|
||||||
|
<!-- History items would go here -->
|
||||||
|
<div class="text-muted small px-3">No recent chats</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sidebar-footer">
|
||||||
|
<button class="btn btn-sm w-100 text-start text-muted d-flex align-items-center gap-2" data-bs-toggle="modal" data-bs-target="#settingsModal">
|
||||||
|
<i class="bi bi-gear"></i>
|
||||||
|
<span>Settings & Themes</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main id="main-content">
|
||||||
|
<header class="p-3 border-bottom d-flex justify-content-between align-items-center">
|
||||||
|
<div class="d-flex align-items-center gap-2">
|
||||||
|
<span id="current-mode-badge" class="badge bg-primary-subtle text-primary border border-primary-subtle">Regular</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<button class="btn btn-sm btn-outline-secondary" id="new-chat-btn"><i class="bi bi-plus-lg me-1"></i> New Chat</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="chat-container" id="chat-window">
|
||||||
|
<div class="text-center my-auto">
|
||||||
|
<i class="bi bi-stars fs-1 text-primary opacity-50"></i>
|
||||||
|
<h4 class="mt-3">How can I help you today?</h4>
|
||||||
|
<p class="text-muted">Choose a mode from the sidebar to get started.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-area">
|
||||||
|
<div class="input-wrapper">
|
||||||
|
<textarea id="chat-input" placeholder="Type your message..." rows="1"></textarea>
|
||||||
|
<button id="send-btn"><i class="bi bi-arrow-up-circle-fill"></i></button>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-2">
|
||||||
|
<small class="text-muted" style="font-size: 0.7rem;">AI can make mistakes. Check important info.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Settings Modal -->
|
||||||
|
<div class="modal fade" id="settingsModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Settings</h5>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label d-flex justify-content-between">
|
||||||
|
Creativity Level
|
||||||
|
<span id="creativity-val" class="text-primary fw-bold"><?php echo $creativity; ?></span>
|
||||||
|
</label>
|
||||||
|
<input type="range" class="form-range" id="creativity-range" min="0" max="1" step="0.1" value="<?php echo $creativity; ?>">
|
||||||
|
<div class="d-flex justify-content-between small text-muted">
|
||||||
|
<span>Precise</span>
|
||||||
|
<span>Creative</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-4">
|
||||||
|
<input class="form-check-input" type="checkbox" id="limits-toggle" <?php echo $limitsOff === '1' ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="limits-toggle">Turn off creativity limits</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h6>Themes</h6>
|
||||||
|
<div class="theme-grid mt-2">
|
||||||
|
<div class="theme-swatch" data-theme="theme-dark-modern" style="background:#0f172a; color:#fff;">Dark Modern</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-light-minimal" style="background:#ffffff; color:#000; border:1px solid #ddd;">Light Minimal</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-midnight" style="background:#000000; color:#fff;">Midnight</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-forest" style="background:#064e3b; color:#fff;">Forest</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-ocean" style="background:#0c4a6e; color:#fff;">Ocean</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-slate" style="background:#334155; color:#fff;">Slate</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-nord" style="background:#2e3440; color:#eceff4;">Nord</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-sepia" style="background:#704214; color:#fdf6e3;">Sepia</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-cyberpunk" style="background:#1a1a1a; color:#f3f;">Cyberpunk</div>
|
||||||
|
<div class="theme-swatch" data-theme="theme-matrix" style="background:#000; color:#0f0;">Matrix</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="save-settings-btn">Save changes</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</div>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</footer>
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user