feat: декомпозиция JS на модули (auth, tasks, chat, app) и добавление гостевого режима с локальной нейросетью
This commit is contained in:
+91
-42
@@ -2,98 +2,147 @@
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
||||
<title>SCUD Orion AI — Context Manager</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">
|
||||
<link rel="stylesheet" href="/static/css/styles.css">
|
||||
</head>
|
||||
<body class="bg-slate-100 text-slate-800 h-screen w-full flex flex-col font-sans overflow-hidden">
|
||||
<body class="bg-slate-100 text-slate-800 h-[100dvh] w-full flex flex-col font-sans overflow-hidden">
|
||||
|
||||
<!-- Окно авторизации c гостевым входом -->
|
||||
<div id="auth-modal" class="fixed inset-0 bg-slate-900/80 backdrop-blur-md z-50 flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-2xl p-6 sm:p-8 max-w-md w-full shadow-2xl border border-slate-200">
|
||||
<div class="flex items-center space-x-3 mb-6">
|
||||
<div class="bg-indigo-600 text-white p-3 rounded-xl">
|
||||
<i class="fa-solid fa-lock text-xl"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-lg font-bold text-slate-900">SCUD Orion AI</h2>
|
||||
<p class="text-xs text-slate-500">Авторизация в системе</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="auth-form" onsubmit="handleLogin(event)" class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-700 uppercase tracking-wider mb-2">API Token</label>
|
||||
<input type="password" id="auth-token-input" placeholder="Введите API токен..."
|
||||
class="w-full bg-slate-50 border border-slate-300 rounded-xl px-4 py-3 text-sm text-slate-900 focus:outline-none focus:border-indigo-600 focus:bg-white transition">
|
||||
</div>
|
||||
|
||||
<div id="auth-error" class="hidden text-xs text-red-600 font-medium bg-red-50 p-3 rounded-xl border border-red-200">
|
||||
Неверный токен доступа.
|
||||
</div>
|
||||
|
||||
<button type="submit" id="auth-btn" class="w-full bg-indigo-600 hover:bg-indigo-700 active:bg-indigo-800 text-white font-semibold py-3 rounded-xl text-sm transition shadow-md flex items-center justify-center gap-2">
|
||||
<i class="fa-solid fa-right-to-bracket"></i>
|
||||
<span>Войти с токеном</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="relative my-5">
|
||||
<div class="absolute inset-0 flex items-center"><div class="w-full border-t border-slate-200"></div></div>
|
||||
<div class="relative flex justify-center text-xs uppercase"><span class="bg-white px-2 text-slate-400 font-medium">Или</span></div>
|
||||
</div>
|
||||
|
||||
<button onclick="enableGuestMode()" class="w-full bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-3 rounded-xl text-sm transition border border-slate-300 flex items-center justify-center gap-2">
|
||||
<i class="fa-solid fa-user-ninja"></i>
|
||||
<span>Войти как гость (Локальный ИИ)</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Хедер -->
|
||||
<header class="bg-white border-b border-slate-200 px-3 sm:px-6 py-2.5 sm:py-3 flex justify-between items-center shadow-sm shrink-0">
|
||||
<div class="flex items-center space-x-2">
|
||||
<div class="bg-indigo-600 text-white p-1.5 sm:p-2 rounded-lg shrink-0">
|
||||
<i class="fa-solid fa-brain text-sm sm:text-lg"></i>
|
||||
<header class="bg-white border-b border-slate-200 px-4 py-2.5 flex justify-between items-center shadow-sm shrink-0 z-20">
|
||||
<div class="flex items-center space-x-2.5">
|
||||
<div class="bg-indigo-600 text-white p-2 rounded-xl shrink-0">
|
||||
<i class="fa-solid fa-brain text-lg"></i>
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<h1 class="text-sm sm:text-base font-bold leading-tight text-slate-900 truncate">SCUD Orion AI</h1>
|
||||
<span class="hidden sm:inline text-xs text-slate-500">Context & Task Manager</span>
|
||||
<div>
|
||||
<h1 class="text-sm font-bold text-slate-900 leading-tight">SCUD Orion AI</h1>
|
||||
<span class="text-[11px] text-slate-500">Task & Context API</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-2 shrink-0">
|
||||
<span class="flex items-center text-[10px] sm:text-xs text-emerald-600 font-medium bg-emerald-50 px-2 py-1 rounded-full border border-emerald-200">
|
||||
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500 mr-1"></span> API Online
|
||||
<div class="flex items-center space-x-2">
|
||||
<span id="guest-badge" class="hidden text-[10px] text-amber-700 font-semibold bg-amber-50 px-2 py-0.5 rounded-full border border-amber-200">
|
||||
Гостевой режим
|
||||
</span>
|
||||
<button onclick="toggleDrawer()" class="bg-indigo-50 hover:bg-indigo-100 text-indigo-700 px-2.5 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition border border-indigo-200">
|
||||
<i class="fa-solid fa-list-check text-indigo-600"></i>
|
||||
<span class="hidden sm:inline">Задачи</span>
|
||||
<span id="task-count-badge" class="bg-indigo-600 text-white text-[10px] px-1.5 py-0.2 rounded-full">0</span>
|
||||
|
||||
<button id="tasks-drawer-btn" onclick="toggleDrawer()" class="bg-indigo-600 active:bg-indigo-700 text-white px-3 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-sm">
|
||||
<i class="fa-solid fa-list-check"></i>
|
||||
<span>Задачи</span>
|
||||
<span id="task-count-badge" class="bg-white text-indigo-700 text-[10px] font-bold px-1.5 py-0.2 rounded-full">0</span>
|
||||
</button>
|
||||
<button onclick="logout()" class="text-slate-400 hover:text-red-600 transition p-2 rounded-xl" title="Выйти">
|
||||
<i class="fa-solid fa-right-from-bracket text-base"></i>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Основная зона чата -->
|
||||
<main class="flex-1 flex flex-col w-full max-w-4xl mx-auto bg-white sm:my-3 sm:rounded-xl border-y sm:border border-slate-200 shadow-sm overflow-hidden min-h-0">
|
||||
<div id="chat-window" class="flex-1 p-3 sm:p-5 overflow-y-auto space-y-3 bg-slate-50/50">
|
||||
<div class="bg-white border border-slate-200 rounded-xl p-3 sm:p-4 max-w-2xl shadow-sm">
|
||||
<!-- Главный контейнер -->
|
||||
<div class="flex-1 flex flex-col min-h-0 w-full max-w-4xl mx-auto bg-white relative overflow-hidden">
|
||||
<div id="chat-window" class="flex-1 p-3.5 overflow-y-auto space-y-3 bg-slate-50/50">
|
||||
<div class="bg-white border border-slate-200 rounded-2xl p-3.5 shadow-sm">
|
||||
<p class="text-[11px] font-bold text-indigo-600 uppercase tracking-wider mb-1">
|
||||
<i class="fa-solid fa-robot mr-1"></i> ИИ-Ассистент
|
||||
</p>
|
||||
<p class="text-slate-700 text-xs sm:text-sm leading-relaxed">
|
||||
Привет! Я подключен к вашей базе задач и системным промптам. Вы можете писать команды прямо в чат или управлять задачами через панель задач.
|
||||
<p class="text-slate-800 text-xs sm:text-sm leading-relaxed">
|
||||
Привет! Задавайте вопросы нейросети прямо в чат.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Поле ввода -->
|
||||
<div class="p-2 sm:p-3 bg-white border-t border-slate-200 shrink-0">
|
||||
<form id="chat-form" onsubmit="sendMessage(event)" class="flex items-end gap-1.5 sm:gap-2">
|
||||
<div class="flex-1 bg-slate-50 border border-slate-300 rounded-xl p-1 focus-within:border-indigo-600 focus-within:bg-white transition">
|
||||
<div class="p-2.5 pb-6 bg-white border-t border-slate-200 shrink-0 z-10 shadow-lg">
|
||||
<form id="chat-form" onsubmit="sendMessage(event)" class="flex items-center gap-2">
|
||||
<div class="flex-1 bg-slate-100 border border-slate-300 rounded-2xl px-3 py-1.5 focus-within:border-indigo-600 focus-within:bg-white transition">
|
||||
<textarea id="user-input" rows="1" autocomplete="off" autocorrect="off" spellcheck="false"
|
||||
placeholder="Команда или вопрос..."
|
||||
class="w-full bg-transparent text-slate-800 px-2.5 py-1.5 text-sm sm:text-base focus:outline-none resize-none overflow-y-auto max-h-[96px] leading-relaxed fade-scroll-top no-scrollbar"></textarea>
|
||||
class="w-full bg-transparent text-slate-900 text-sm focus:outline-none resize-none overflow-y-auto max-h-[80px] leading-normal no-scrollbar"></textarea>
|
||||
</div>
|
||||
<button type="submit" id="send-btn" class="bg-indigo-600 hover:bg-indigo-700 active:bg-indigo-800 text-white font-medium px-4 h-[42px] rounded-xl text-sm transition flex items-center justify-center gap-1.5 shrink-0">
|
||||
<span class="hidden sm:inline">Отправить</span>
|
||||
<button type="submit" id="send-btn" class="bg-indigo-600 active:bg-indigo-800 text-white font-semibold px-3.5 py-2.5 rounded-2xl text-xs sm:text-sm transition flex items-center justify-center gap-1.5 shrink-0 shadow-sm">
|
||||
<span>Отправить</span>
|
||||
<i class="fa-solid fa-paper-plane text-xs"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<!-- Выезжающая панель (Drawer) -->
|
||||
<div id="drawer-backdrop" onclick="toggleDrawer()" class="fixed inset-0 bg-slate-900/40 backdrop-blur-sm hidden transition-opacity z-40"></div>
|
||||
<div id="drawer-backdrop" onclick="toggleDrawer()" class="fixed inset-0 bg-slate-900/50 backdrop-blur-sm hidden transition-opacity z-40"></div>
|
||||
|
||||
<aside id="task-drawer" class="fixed right-0 top-0 h-full w-full sm:w-[420px] bg-white border-l border-slate-200 shadow-2xl transform translate-x-full transition-transform duration-300 ease-in-out z-50 flex flex-col">
|
||||
<div class="p-3 sm:p-4 border-b border-slate-200 flex justify-between items-center bg-slate-50 shrink-0">
|
||||
<div class="p-3.5 border-b border-slate-200 flex justify-between items-center bg-slate-50 shrink-0">
|
||||
<h2 class="font-bold text-slate-800 flex items-center gap-2 text-sm">
|
||||
<i class="fa-solid fa-list-check text-indigo-600"></i> Реестр задач
|
||||
</h2>
|
||||
<div class="flex items-center gap-2">
|
||||
<button onclick="loadTasks()" class="text-xs text-slate-500 hover:text-indigo-600 transition p-2" title="Обновить">
|
||||
<i class="fa-solid fa-rotate-right"></i>
|
||||
<div class="flex items-center gap-3">
|
||||
<button onclick="loadTasks()" class="text-xs text-slate-500 hover:text-indigo-600 transition p-1" title="Обновить">
|
||||
<i class="fa-solid fa-rotate-right text-sm"></i>
|
||||
</button>
|
||||
<button onclick="toggleDrawer()" class="text-slate-400 hover:text-slate-700 transition p-2">
|
||||
<button onclick="toggleDrawer()" class="text-slate-500 hover:text-slate-800 transition p-1">
|
||||
<i class="fa-solid fa-xmark text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Фильтры задач -->
|
||||
<div class="flex border-b border-slate-200 bg-white px-2 pt-2 text-xs font-medium text-slate-500 gap-1 overflow-x-auto no-scrollbar shrink-0">
|
||||
<div class="flex border-b border-slate-200 bg-white px-2 pt-2 text-xs font-semibold text-slate-500 gap-1 overflow-x-auto no-scrollbar shrink-0">
|
||||
<button onclick="setFilter('ALL')" id="filter-ALL" class="px-3 py-1.5 rounded-t-lg border-b-2 border-indigo-600 text-indigo-600 font-bold whitespace-nowrap">Все</button>
|
||||
<button onclick="setFilter('IN_PROGRESS')" id="filter-IN_PROGRESS" class="px-3 py-1.5 rounded-t-lg border-b-2 border-transparent hover:text-slate-700 whitespace-nowrap">В работе</button>
|
||||
<button onclick="setFilter('BACKLOG')" id="filter-BACKLOG" class="px-3 py-1.5 rounded-t-lg border-b-2 border-transparent hover:text-slate-700 whitespace-nowrap">Бэклог</button>
|
||||
<button onclick="setFilter('COMPLETED')" id="filter-COMPLETED" class="px-3 py-1.5 rounded-t-lg border-b-2 border-transparent hover:text-slate-700 whitespace-nowrap">Завершено</button>
|
||||
<button onclick="setFilter('IN_PROGRESS')" id="filter-IN_PROGRESS" class="px-3 py-1.5 rounded-t-lg border-b-2 border-transparent whitespace-nowrap">В работе</button>
|
||||
<button onclick="setFilter('BACKLOG')" id="filter-BACKLOG" class="px-3 py-1.5 rounded-t-lg border-b-2 border-transparent whitespace-nowrap">Бэклог</button>
|
||||
<button onclick="setFilter('COMPLETED')" id="filter-COMPLETED" class="px-3 py-1.5 rounded-t-lg border-b-2 border-transparent whitespace-nowrap">Завершено</button>
|
||||
</div>
|
||||
|
||||
<div id="tasks-container" class="flex-1 overflow-y-auto p-3.5 sm:p-4 space-y-3 bg-slate-50/50">
|
||||
<div id="tasks-container" class="flex-1 overflow-y-auto p-3.5 space-y-3 bg-slate-50/50 pb-8">
|
||||
<div class="text-center text-slate-400 py-8 text-xs">Загрузка задач...</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Порядок подключения модулей JS -->
|
||||
<script src="/static/js/auth.js"></script>
|
||||
<script src="/static/js/tasks.js"></script>
|
||||
<script src="/static/js/chat.js"></script>
|
||||
<script src="/static/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user