Skip to content

Fix/text response - #27

Merged
Voronapxl merged 10 commits into
devfrom
fix/text_response
Jul 14, 2026
Merged

Fix/text response#27
Voronapxl merged 10 commits into
devfrom
fix/text_response

Conversation

@Voronapxl

Copy link
Copy Markdown
Collaborator

No description provided.

Voronapxl and others added 10 commits July 7, 2026 17:28
…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.
@Voronapxl
Voronapxl merged commit d58395d into dev Jul 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant