fix: reopen result modal from progress bar, faster progress, handle LLM context error

- Move import modal visibility into ImportContext so the Layout
  progress pill can reopen the result dialog after the modal was closed.
- Raise LLM progress cap from 85% to 98% and drop the intermediate
  -import 88%- SSE event to eliminate the visual stall after LLM finishes.
- Detect LLM context-length errors (n_keep >= n_ctx) and surface a
  clear message instead of generic -Временная ошибка конвертации-.
This commit is contained in:
vakabunga
2026-03-14 17:05:55 +03:00
parent 22be09c101
commit e28d0f46d0
6 changed files with 36 additions and 19 deletions

View File

@@ -18,6 +18,7 @@ import { TransactionTable } from '../components/TransactionTable';
import { Pagination } from '../components/Pagination';
import { EditTransactionModal } from '../components/EditTransactionModal';
import { ImportModal } from '../components/ImportModal';
import { useImport } from '../context/ImportContext';
import { toISODate } from '../utils/format';
const PARAM_KEYS = [
@@ -125,7 +126,7 @@ export function HistoryPage() {
const [accounts, setAccounts] = useState<Account[]>([]);
const [categories, setCategories] = useState<Category[]>([]);
const [editingTx, setEditingTx] = useState<Transaction | null>(null);
const [showImport, setShowImport] = useState(false);
const { showModal: showImport, openModal: openImport, closeModal: closeImport, clearImport } = useImport();
useEffect(() => {
getAccounts().then(setAccounts).catch(() => {});
@@ -197,7 +198,8 @@ export function HistoryPage() {
};
const handleImportDone = () => {
setShowImport(false);
closeImport();
clearImport();
fetchData();
getAccounts().then(setAccounts).catch(() => {});
};
@@ -208,7 +210,7 @@ export function HistoryPage() {
<h1>История операций</h1>
<button
className="btn btn-primary"
onClick={() => setShowImport(true)}
onClick={openImport}
>
Импорт выписки
</button>
@@ -262,7 +264,7 @@ export function HistoryPage() {
{showImport && (
<ImportModal
onClose={() => setShowImport(false)}
onClose={closeImport}
onDone={handleImportDone}
/>
)}