Fix/text response - #27
Merged
Merged
Conversation
…rding
Two features that touch the same files, committed together.
1) mode=building_pzz_check — deterministic PZZ check for user-uploaded
buildings/services (no LLM). New UploadedBuildingPzzRunner sharing a
_deterministic_pzz core with the scenario runner; building
type/service/floors column auto-detection (BUILDING_TARGETS);
service_type_id -> VRI dictionary; PipelineTask.building_* columns
(+ alembic 0004); factory routing via is_building_upload; "bld:"
idempotency -> default queue.
2) PZZ chat answer/narrative rework — detection narrative reworded
("определено как", expanded ВРИ/ПЗЗ, unified list markers), grounded
answer terminology (участок / территориальная зона ПЗЗ, no "объект" or
invented "неясно"), reconciled totals (zones_count / not_in_zone,
correct + wrong + unclear = total) and manual-review split by the
"Вердикт_ПЗЗ" reason. System prompt and frontend guide updated.
Self-contained docker-compose.localtest.yml (postgres + redis + one-shot migrate + api + default/llm workers) and helper scripts for smoke-testing the scenario classify, chat and SSE-stream flows against the local stack.
Rework the conversational PZZ-check answer and enrich its grounding so the LLM explains results in depth instead of restating the deterministic summary. Chat answer (chat_system_prompt.txt, classifier.py, tasks.py, chat_answer.py): - deterministic chat_message: prepend ВРИ/ПЗЗ definitions, drop the per-zone tail (it now lives in the LLM answer), keep the full «земельный участок» form, and reference the «Вердикт_ПЗЗ» attribute instead of «отфильтровать». - LLM answer repositioned as the main detailed report: opens with definitions, per-category + per-zone breakdown, manual-review causes described by meaning (no «требуется ручная проверка» self-collision), official register, markdown allowed, and no closing "further analysis" offers. - grounding enriched: compact per-zone breakdown + aggregated manual-review reasons + per-problem assigned ВРИ (code+name resolved from the Rosreestr classifier by_code), so the answer stays specific even when the full report is too large to include. - default auto queries reworded to request a detailed analysis. Building runner (_deterministic_pzz.py, uploaded_building_pzz_runner.py, tasks.py): - new result column «Основание_подбора_ВРИ» records how the ВРИ was resolved (by floors / service type / object type); read into the object-zone-fit report and forwarded to the grounding. output_version: bump v2 -> v3 (new result column). tests: assert the 8-column building result whitelist + the resolution basis.
Add concrete GeoJSON/JSON examples for the three building_pzz_check inputs (buildings layer, PZZ zones layer, optional zone descriptions), note the EPSG:4326 / supported-format requirement, and correct the result column count to 8 (new «Основание_подбора_ВРИ»).
Add a "Как выводить LLM-сообщение в чат" subsection to section H: accumulate chunk.content.text until done, render as Markdown (not plain-text), leading column-detection narrative is part of the same chunk stream, and chat_message as a fast/fallback summary.
A merged buildings+services layer lists all physical objects first and services only later, so service_type_id (first seen past feature 1500) was invisible to the first-50-feature scan and building_service_col never resolved. Profile column discovery now scans every feature; per-column value sampling stays bounded.
building_pzz_check now tags each result feature with «Категория_объекта» («Здание»/«Сервис») and serves the result as two layers — result_buildings / result_services — filtered from the combined result on the fly. Two file events (role=result) with durable urls; no storage/model change.
Resolve unknown building type/service text names through deterministic-first batched LLM mapping, mark AI-derived matches in the VRI basis, keep unresolved service rows in the services layer, and harden Ollama JSON parsing for reasoning wrappers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.