domovoy_bot/web/templates/legal.html

217 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block title %}Нормативно-правовая база & ИИ-Юрист | LKM37{% endblock %}
{% block nav_legal %}active{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
<h3 class="m-0" style="font-size: 18px; font-weight: bold;">НОРМАТИВНО-ПРАВОВАЯ БАЗА РФ & ИИ-ЮРИСТ</h3>
<div>
<button class="btn-unix btn-unix-primary" onclick="syncNotebookLM()">
<i class="bi bi-arrow-repeat"></i> Синхронизация с NotebookLM
</button>
<button class="btn-unix" onclick="generatePodcast()">
<i class="bi bi-mic"></i> Сгенерировать подкаст (Audio Overview)
</button>
</div>
</div>
<div class="row">
<!-- Левая колонка: Реестр полных законов РФ -->
<div class="col-md-7">
<div class="panel">
<div class="panel-header d-flex justify-content-between align-items-center">
<span>ПОЛНЫЕ ОФИЦИАЛЬНЫЕ КОДЕКСЫ И НОРМАТИВНЫЕ АКТЫ РФ (100% ТЕКСТ)</span>
<span class="badge-status badge-success">{{ laws|length }} документов</span>
</div>
<div class="panel-body p-0">
<table>
<thead>
<tr>
<th style="width: 45px;">№</th>
<th>Наименование нормативно-правового акта</th>
<th style="width: 75px;">Стр.</th>
<th style="width: 85px;">Размер</th>
<th style="width: 100px;">Действие</th>
</tr>
</thead>
<tbody>
{% for law in laws %}
<tr>
<td>{{ loop.index }}</td>
<td>
<strong>{{ law.title }}</strong><br>
<small style="color: var(--text-muted);">{{ law.filename }}</small>
</td>
<td>{{ law.pages }}</td>
<td>{{ law.size_formatted }}</td>
<td>
<a href="/api/legal/download/{{ law.filename }}" class="btn-unix" download>
<i class="bi bi-download"></i> PDF
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Карточка томов переписки -->
<div class="panel">
<div class="panel-header d-flex justify-content-between align-items-center">
<span>СВОДНЫЕ ТОМА ПЕРЕПИСКИ С ГОСОРГАНАМИ & ШТАМПЫ ЭЦП</span>
<span class="badge-status badge-success">{{ mega_volumes|length }} тома</span>
</div>
<div class="panel-body p-0">
<table>
<thead>
<tr>
<th>Том переписки</th>
<th>Размер</th>
<th>Оглавление TOC</th>
<th>Действие</th>
</tr>
</thead>
<tbody>
{% for vol in mega_volumes %}
<tr>
<td><strong>{{ vol.name }}</strong></td>
<td>{{ vol.size_formatted }}</td>
<td><span class="badge-status badge-success">Вшито в PDF</span></td>
<td>
<a href="/api/legal/download_volume/{{ vol.name }}" class="btn-unix" download>
<i class="bi bi-download"></i> Скачать
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<!-- Правая колонка: ИИ-Консультант и Генератор Подкастов -->
<div class="col-md-5">
<!-- Интерактивный AI-Юрист -->
<div class="panel">
<div class="panel-header">
<i class="bi bi-cpu"></i> АВТОНОМНЫЙ ИИ-КОНСУЛЬТАНТ (GEMINI 2.5)
</div>
<div class="panel-body">
<p style="font-size: 11px; color: var(--text-muted); margin-bottom: 8px;">
Контекст: Полный свод ЖК РФ, ГК РФ, 59-ФЗ, ПП 354, ПП 491, Госстрой 170 + 610 писем дома с верифицированными ЭЦП.
</p>
<div class="mb-2">
<label style="font-weight: bold; font-size: 11px;">Вопрос / Фабула ситуации:</label>
<textarea id="ai-query" class="form-control" rows="4" style="font-family: inherit; font-size: 12px; border: 1px solid var(--border-color); border-radius: 0;" placeholder="Например: УК отказалась делать перерасчет за отопление в подъезде 4, утверждая что перерыв не превышал допустимой нормы. На какие пункты ПП 354 и Госстроя 170 сослаться в претензии?"></textarea>
</div>
<div class="d-flex justify-content-between align-items-center mb-2">
<div>
<input type="checkbox" id="ai-deep-mode">
<label for="ai-deep-mode" style="font-size: 11px; cursor: pointer;">Глубокий анализ (Gemini 2.5 Pro)</label>
</div>
<button class="btn-unix btn-unix-primary" onclick="askAiLawyer()">
<i class="bi bi-send"></i> Сформировать позицию
</button>
</div>
<div id="ai-response-box" style="display: none; margin-top: 12px; border-top: 1px dashed var(--border-color); padding-top: 10px;">
<div class="d-flex justify-content-between align-items-center mb-1">
<strong style="font-size: 11px;">ОТВЕТ ИИ-ЮРИСТА:</strong>
<span id="ai-model-tag" class="badge-status badge-success">Flash</span>
</div>
<div id="ai-response-text" style="background-color: #fafafa; border: 1px solid var(--border-light); padding: 8px; font-size: 11px; white-space: pre-wrap; max-height: 400px; overflow-y: auto;"></div>
</div>
</div>
</div>
<!-- Аудио-подкасты NotebookLM -->
<div class="panel">
<div class="panel-header">
<i class="bi bi-soundwave"></i> АУДИО-ПОДКАСТЫ ДОМА (AUDIO OVERVIEWS)
</div>
<div class="panel-body">
<p style="font-size: 11px; color: var(--text-muted); margin-bottom: 8px;">
Автоматическая генерация аналитических подкастов диалога двух экспертов по делам дома.
</p>
<div id="podcast-status-box">
{% if latest_podcast %}
<div class="mb-2">
<strong>Последний подкаст:</strong> {{ latest_podcast.name }}<br>
<small style="color: var(--text-muted);">Размер: {{ latest_podcast.size }} | Дата: {{ latest_podcast.date }}</small>
</div>
<audio controls style="width: 100%; margin-bottom: 8px;">
<source src="/api/legal/podcasts/{{ latest_podcast.name }}" type="audio/mp4">
Ваш браузер не поддерживает аудио.
</audio>
{% else %}
<p style="font-size: 11px; font-style: italic; color: var(--text-muted);">
Подкасты еще не генерировались. Нажмите кнопку генерации выше.
</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
async function askAiLawyer() {
const query = document.getElementById('ai-query').value.trim();
if (!query) {
alert('Пожалуйста, введите текст вопроса');
return;
}
const deep = document.getElementById('ai-deep-mode').checked;
const resBox = document.getElementById('ai-response-box');
const resText = document.getElementById('ai-response-text');
const tag = document.getElementById('ai-model-tag');
resBox.style.display = 'block';
resText.innerText = 'Анализ правовой базы и судебной практики... Пожалуйста, подождите.';
tag.innerText = deep ? 'Gemini 2.5 Pro' : 'Gemini 2.5 Flash';
try {
const resp = await fetch('/api/legal/ask_ai', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({query: query, deep: deep})
});
const data = await resp.json();
if (data.success) {
resText.innerText = data.answer;
} else {
resText.innerText = 'Ошибка: ' + (data.error || 'Неизвестная ошибка');
}
} catch (e) {
resText.innerText = 'Сетевая ошибка обращения к ИИ-Юристу: ' + e;
}
}
async function syncNotebookLM() {
if (!confirm('Запустить полную синхронизацию законов и томов переписки с Google NotebookLM?')) return;
try {
const resp = await fetch('/api/legal/notebooklm_sync', {method: 'POST'});
const data = await resp.json();
alert(data.message || 'Синхронизация завершена!');
} catch (e) {
alert('Ошибка запуска синхронизации: ' + e);
}
}
async function generatePodcast() {
if (!confirm('Запустить генерацию Audio Overview подкаста в NotebookLM?')) return;
try {
const resp = await fetch('/api/legal/generate_podcast', {method: 'POST'});
const data = await resp.json();
alert(data.message || 'Задача генерации подкаста запущена!');
} catch (e) {
alert('Ошибка запуска генерации подкаста: ' + e);
}
}
</script>
{% endblock %}