Исправление ошибок, добавление ИИ-ассистента

This commit is contained in:
2026-02-16 14:43:14 +03:00
parent 5b7ea9276b
commit 213d2bcb5a
18 changed files with 1672 additions and 426 deletions
@@ -1,4 +1,25 @@
{% extends "base.html" %}{% block content %}
<style>
.typing-cursor::after {
content: '▋';
display: inline-block;
vertical-align: bottom;
animation: blink 1s step-end infinite;
margin-left: 2px;
opacity: 0.7;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
.fade-in {
animation: fadeIn 0.3s ease-in-out forwards;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-5px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
<div class="container mx-auto p-4 max-w-3xl">
<div class="bg-white rounded-lg shadow-md p-6 md:p-8">
<div class="mb-8 border-b border-gray-100 pb-4">
@@ -25,6 +46,64 @@
</p>
</div>
<form id="create-book-form" class="space-y-6">
<div id="ai-widget" class="hidden border border-gray-200 rounded-lg overflow-hidden bg-white shadow-sm transition-shadow hover:shadow-md">
<div class="bg-gray-50 border-b border-gray-200 px-4 py-2.5 flex justify-between items-center select-none">
<div class="flex items-center gap-2.5">
<div id="ai-logo" class="cursor-pointer p-1 bg-white border border-gray-200 rounded shadow-sm">
<svg class="w-5 h-5 text-gray-800" fill="currentColor" viewBox="0 0 24 24">
<rect x="2" y="19" width="20" height="3" rx="0.8" fill="currentColor" opacity="0.9"/>
<path d="M12 17V7c0 0-2.5-2-6-2-1.8 0-3 .4-3.5.6V17c.8-.3 2-.5 3.5-.5 3.2 0 6 1.5 6 1.5z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>
<path d="M12 17V7c0 0 2.5-2 6-2 1.8 0 3 .4 3.5.6V17c-.8-.3-2-.5-3.5-.5-3.2 0-6 1.5-6 1.5z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>
<circle cx="12" cy="2.8" r="2" fill="currentColor"/>
<circle cx="7.5" cy="3.8" r="1" fill="currentColor"/>
<circle cx="16.5" cy="3.8" r="1" fill="currentColor"/>
<line x1="10.2" y1="3" x2="8.4" y2="3.6" stroke="currentColor" stroke-width="1"/>
<line x1="13.8" y1="3" x2="15.6" y2="3.6" stroke="currentColor" stroke-width="1"/>
</svg>
</div>
<span class="text-xs font-bold text-gray-700 tracking-[0.15em] uppercase">ИИ-помощник</span>
</div>
<div class="flex items-center gap-2">
<span class="text-[10px] font-mono uppercase text-gray-400" id="ai-status-text">Готов</span>
<span class="relative flex h-2 w-2">
<span id="ai-status-ping" class="hidden animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
<span id="ai-status-dot" class="relative inline-flex rounded-full h-2 w-2 bg-gray-300 transition-colors duration-300"></span>
</span>
</div>
</div>
<div id="ai-log-container" class="hidden border-b border-gray-100 bg-white max-h-80 overflow-y-auto">
<div id="ai-log-entries"></div>
</div>
<div class="flex relative bg-white">
<input
type="text"
id="ai-input"
class="flex-1 px-4 py-3.5 text-sm text-gray-900 placeholder-gray-400 bg-transparent focus:outline-none focus:bg-gray-50 transition-colors"
placeholder="Напишите задачу (например: 'Придумай драматичное описание')..."
autocomplete="off"
/>
<div class="flex border-l border-gray-100 items-center">
<button type="button" id="ai-btn-stop"
class="hidden px-5 py-2 h-full bg-white text-red-600 text-xs font-bold tracking-widest hover:bg-red-50 transition-colors flex items-center gap-2">
<span>СТОП</span>
<span class="block w-2 h-2 bg-red-600 rounded-sm"></span>
</button>
<button type="button" id="ai-btn-run"
class="group px-6 py-2 h-full bg-white text-gray-900 text-xs font-bold tracking-widest hover:bg-gray-900 hover:text-white transition-all duration-300 flex items-center gap-2">
<span>СТАРТ</span>
<svg class="w-3 h-3 transition-transform group-hover:translate-x-0.5"
fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3"></path>
</svg>
</button>
</div>
</div>
</div>
<div>
<label
for="book-title"