по идее, рабочий вариант, нужно откатить после неудачного слияния проектов. Не работает демон веб морды.

This commit is contained in:
2026-08-07 07:58:30 +03:00
parent 18392f11ef
commit 3405d86946
2 changed files with 390 additions and 142 deletions
+88 -22
View File
@@ -6,6 +6,21 @@
<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">
<style>
/* Плавное (градиентное) исчезновение текста сверху при скролле */
.fade-scroll-top {
mask-image: linear-gradient(to bottom, transparent 0%, black 14px);
-webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 14px);
}
/* Скрытие стандартного скроллбара */
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.no-scrollbar {
-ms-overflow-style: none;
scrollbar-width: none;
}
</style>
</head>
<body class="bg-slate-50 text-slate-800 h-screen flex flex-col font-sans">
@@ -33,7 +48,7 @@
</div>
</header>
<!-- Основное окно чата -->
<!-- Основная зона чата -->
<main class="flex-1 flex flex-col max-w-4xl w-full mx-auto bg-white my-4 rounded-xl border border-slate-200 shadow-sm overflow-hidden">
<div id="chat-window" class="flex-1 p-6 overflow-y-auto space-y-4 bg-slate-50/50">
<div class="bg-white border border-slate-200 rounded-xl p-4 max-w-2xl shadow-sm">
@@ -41,16 +56,20 @@
<i class="fa-solid fa-robot mr-1"></i> ИИ-Ассистент
</p>
<p class="text-slate-700 text-sm leading-relaxed">
Привет! Я подключен к вашей базе задач. Вы можете писать мне в чат или управлять задачами в реестре справа.
Привет! Я подключен к вашей базе задач и системным промптам. Вы можете писать команды прямо в чат или управлять задачами через панель справа.
</p>
</div>
</div>
<!-- Поле ввода с авто-высотой, отключенным автокомплитом и сохраненной историей -->
<div class="p-4 bg-white border-t border-slate-200">
<form id="chat-form" onsubmit="sendMessage(event)" class="flex gap-2">
<input type="text" id="user-input" placeholder="Команда или вопрос (например: 'покажи все задачи')..."
class="flex-1 bg-slate-50 border border-slate-300 text-slate-800 rounded-lg px-4 py-2.5 text-sm focus:outline-none focus:border-indigo-600 focus:bg-white transition">
<button type="submit" id="send-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium px-5 py-2.5 rounded-lg text-sm transition flex items-center gap-2">
<form id="chat-form" onsubmit="sendMessage(event)" class="flex items-end gap-2">
<div class="flex-1 bg-slate-50 border border-slate-300 rounded-lg p-1 focus-within:border-indigo-600 focus-within:bg-white transition">
<textarea id="user-input" rows="1" autocomplete="off" autocorrect="off" spellcheck="false"
placeholder="Команда или вопрос (Shift+Enter — новая строка, ↑/↓ — история)..."
class="w-full bg-transparent text-slate-800 px-3 py-1.5 text-sm focus:outline-none resize-none overflow-y-auto max-h-[96px] leading-relaxed fade-scroll-top no-scrollbar"></textarea>
</div>
<button type="submit" id="send-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium px-5 h-[42px] rounded-lg text-sm transition flex items-center gap-2 shrink-0">
<span>Отправить</span>
<i class="fa-solid fa-paper-plane text-xs"></i>
</button>
@@ -58,12 +77,11 @@
</div>
</main>
<!-- Выезжающий справа реестр задач (Drawer) -->
<!-- Выезжающая справа панель (Drawer) -->
<div id="drawer-backdrop" onclick="toggleDrawer()" class="fixed inset-0 bg-slate-900/30 backdrop-blur-sm hidden transition-opacity z-40"></div>
<aside id="task-drawer" class="fixed right-0 top-0 h-full 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-4 border-b border-slate-200 flex justify-between items-center bg-slate-50">
<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> Реестр задач
@@ -78,7 +96,7 @@
</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">
<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">Все</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">В работе</button>
@@ -86,7 +104,6 @@
<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">Завершено</button>
</div>
<!-- Список карточек -->
<div id="tasks-container" class="flex-1 overflow-y-auto p-4 space-y-3 bg-slate-50/50">
<div class="text-center text-slate-400 py-8 text-xs">Загрузка задач...</div>
</div>
@@ -95,9 +112,61 @@
<script>
const API_TOKEN = "scud_secret_token_2026";
const SESSION_ID = "web_session_main";
const STORAGE_KEY = 'scud_chat_input_history';
let currentFilter = 'ALL';
let allTasks = [];
// === ИСТОРИЯ КОМАНД (LOCALSTORAGE + СТРЕЛКИ ВВЕРХ/ВНИЗ) ===
let inputHistory = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]');
let historyIndex = -1;
const userInputEl = document.getElementById('user-input');
if (userInputEl) {
// Динамическое расширение высоты поля до 4 строк (~96px)
userInputEl.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = Math.min(this.scrollHeight, 96) + 'px';
});
userInputEl.addEventListener('keydown', function(e) {
// Отправка по Enter (без Shift)
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
document.getElementById('chat-form').requestSubmit();
}
// Стрелка ВВЕРХ — с первого нажатия забираем предыдущую команду
else if (e.key === 'ArrowUp') {
if (inputHistory.length > 0 && historyIndex < inputHistory.length - 1) {
e.preventDefault();
if (historyIndex === -1) {
this.dataset.draft = this.value;
}
historyIndex++;
this.value = inputHistory[inputHistory.length - 1 - historyIndex];
this.dispatchEvent(new Event('input'));
setTimeout(() => this.setSelectionRange(this.value.length, this.value.length), 0);
}
}
// Стрелка ВНИЗ — Навигация к более новым командам
else if (e.key === 'ArrowDown') {
if (historyIndex !== -1) {
e.preventDefault();
if (historyIndex > 0) {
historyIndex--;
this.value = inputHistory[inputHistory.length - 1 - historyIndex];
} else {
historyIndex = -1;
this.value = this.dataset.draft || '';
}
this.dispatchEvent(new Event('input'));
setTimeout(() => this.setSelectionRange(this.value.length, this.value.length), 0);
}
}
});
}
function toggleDrawer() {
const drawer = document.getElementById('task-drawer');
const backdrop = document.getElementById('drawer-backdrop');
@@ -137,18 +206,6 @@
}
}
async function quickUpdateStatus(taskId, newStatus) {
try {
await fetch(`/api/v1/tasks/${taskId}/complete`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${API_TOKEN}` }
});
loadTasks();
} catch (e) {
console.error(e);
}
}
function renderTasks() {
const container = document.getElementById('tasks-container');
const filtered = allTasks.filter(t => currentFilter === 'ALL' || t.status === currentFilter);
@@ -214,6 +271,14 @@
if (!text) return;
// Сохранение истории команд в localStorage (до 50 записей)
if (inputHistory[inputHistory.length - 1] !== text) {
inputHistory.push(text);
if (inputHistory.length > 50) inputHistory.shift();
localStorage.setItem(STORAGE_KEY, JSON.stringify(inputHistory));
}
historyIndex = -1;
chatWindow.innerHTML += `
<div class="flex justify-end">
<div class="bg-indigo-600 text-white rounded-xl px-4 py-2.5 max-w-2xl text-sm shadow-sm">
@@ -222,6 +287,7 @@
</div>
`;
input.value = '';
input.style.height = 'auto';
chatWindow.scrollTop = chatWindow.scrollHeight;
sendBtn.disabled = true;