Skip to content

Feat/llm column choser - #25

Merged
Voronapxl merged 5 commits into
devfrom
feat/llm_column_choser
Jul 7, 2026
Merged

Feat/llm column choser#25
Voronapxl merged 5 commits into
devfrom
feat/llm_column_choser

Conversation

@Voronapxl

Copy link
Copy Markdown
Collaborator

No description provided.

Voronapxl and others added 5 commits June 30, 2026 11:53
… chat warnings

Bundles three related improvements to the PZZ classification chat flow:

- detect: auto-detect the classifier's input columns (cadastral_vri_col,
  pzz_zone_code_col, pzz_zone_name_col) from uploaded layers via an
  exact-name heuristic + an LLM structured-output fallback (enum constrained
  to the real column names, so no hallucinated fields). New endpoint
  POST /tasks/auto/chat/stream announces the recognised mapping as a chat
  narrative, then runs the pipeline. Adds OllamaChatClient.complete_json.

- output: drop urban_api passthrough attributes from the result GeoJSON
  (scenario flow rebuilt clean properties); expose the verdict as a
  human-readable Russian label in the existing Вердикт_ПЗЗ field (was the
  machine allowed_main), and read it back in the object-zone-fit report.

- chat: emit non-fatal ChatStorage persistence failures (e.g. expired token)
  as a `warning` SSE event instead of `error`, so a successfully streamed
  answer that just wasn't saved to history is distinguishable from a real
  service failure. Documented in the frontend API guide.
In classifier-only mode there is no actual zone and no zone-based match, so
the zone code/name, matched VRI name/code and allowed candidate codes are
always empty. select_and_rename_result_columns now takes include_pzz_check
and prunes those five PZZ-specific columns when it is False (12 -> 7 cols).
pzz-check output is unchanged.
…alidation

Result artifacts are immutable and cached by input identity, so a fix to the
output format leaves stale results served until a manual recompute. Introduce
PIPELINE_OUTPUT_VERSION and mix it into every idempotency key (normal tasks
"{mode}:{ver}:{key}", scenarios "...:pv-{ver}"). After a bump old keys stop
matching and the next request recomputes automatically.

The version is also stamped on pipeline_tasks.output_version (migration 0003)
and exposed in TaskOut for observability.
Replace the opaque <external_id>.geojson download names with ASCII English
filenames, resolved per slot and (for the result) per run mode:
  - PZZ check   -> pzz_check_result.geojson / "Результат проверки ПЗЗ"
  - classify    -> classification_result.geojson / "Результат классификации ВРИ"
  - cadastral   -> input_parcels.geojson / "Исходные участки"
  - zones       -> pzz_zones.geojson / "Зоны ПЗЗ"

Add a human-readable RU 'title' (and the machine 'name') to the geo-layer
descriptor and the ChatStorage file-part payload so the frontend has a proper
label instead of the hash. The stable 'name' id is unchanged. Filenames now
apply to the actual downloads (result endpoint + /files redirect) too.

Document the field set (name/title/filename/url/download_url/role) and which to
show in docs/frontend-api-guide.md.
@Voronapxl
Voronapxl merged commit 6a029ec into dev Jul 7, 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