- getDocumentTypes: switch from PostgREST /document_types to
GET /api/document-types
- getTodayDocuments: switch from PostgREST /documents to
GET /api/documents/list with userId + dateFrom params
- getQueueStatus: gracefully handle 404 (endpoint not yet migrated)
by returning empty queue state instead of erroring
Replace the old nested upload_info JSON approach with flat
multipart fields (typeId, region, fileRole, createdBy, autoRun,
speed) matching the new leaudit-platform backend.
- uploadDocumentToServer: POST ${API_BASE_URL}/api/upload
- handleFileUpload: pass region from userInfo.area, derive speed
from priority enum, pass createdBy from JWT user_id
- UploadResult replaces FileUploadResponse with documentId/fileId
replacing the old nested result.id/result.file_name pattern
The axios response interceptor was discarding the server's
permission-denied message (e.g. "缺少「用户列表」权限") and
replacing it with a generic "无权限". Now it reads the server
response body and surfaces the exact permission that's missing.
Previously only provincial_admin could edit roles/permissions in
the UI. Now admin (city-level admin) role can also edit. The
backend already enforces fine-grained permission checks, so the
UI gate just needs to match can_manage semantics.
If the API returns a non-string error (e.g. numeric HTTP status code),
calling .includes() directly on it throws "N.includes is not a function".
Convert to string via JSON.stringify first.
Fixes save button crash on rules/new page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Multiple locations in ReviewSettings.tsx call .includes() or .filter()
on variables that could theoretically be non-arrays:
1. availableFields.filter/.includes - added safeAvailableFields guard
2. newFields.map field.includes('_') - added typeof===string guard + filter
3. (prior fix) cfgAvailableFields includes/every in renderRuleConfig
4. (prior fix) selectedFields includes in renderFieldTags
These prevent TypeError crashes when config objects contain unexpected
types (e.g. {} instead of []) from stale API data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
config.availableFields may be undefined or a non-array value (e.g. {}),
causing TypeError when calling .includes/.every directly on it.
Precompute cfgAvailableFields with Array.isArray guard before use.
Fixes: N.includes is not a function on rules/new page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When config.fields is a non-array value (e.g. empty object {}),
the fallback logic could still result in a non-array if both
config.fields and config.selectedFields are abnormal values.
Added double-guard: after the fallback chain, explicitly assert
Array.isArray before using selectedFields.includes().
Fixes: TypeError: _.includes is not a function on rules/new page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- evaluation_points.ts: LLMFieldConfig type, LLMFieldType union,
VLMField.multi_entity
- ExtractionSettings.tsx:
- LLM fields render as colored buttons (green=multi_entity, gray=normal)
- Click to toggle individual field multi_entity when switch is on
- Toggle switch on: converts all string fields to {name, multi_entity:true}
- Toggle switch off: converts back to plain strings
- New fields default to multi_entity:true when switch is on
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Vite tree-shakes pointCode from intermediate data objects. Fix by
querying evaluation_points.code directly in the route loader with
postgrestGet, then patching pointCode onto reviewPoints before
returning to the client. Works for both legacy and GraphRAG paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Vite's SSR build strips pointCode from ReviewPointResult return objects.
Workaround: pass a separate pointCodeMap from reviews.ts and apply it
in the route loader (reviews.tsx) which Vite preserves.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Vite/Remix tree-shaking was stripping pointCode from the return object
because it wasn't declared in the ReviewPointResult interface.
Also removed debug console.logs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add pointCode field to ReviewPoint interface and data pipeline
- Show code badge (e.g., JZ-DJ-001) before evaluation point name
- Search bar now matches against point code in addition to name
- Updated placeholder to indicate code search support
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Table tooltip now calculates maxWidth from column count (140px/col,
min 400, max 85vw) and maxHeight from row count (30px/row, min 150,
max 70vh) for better readability of large tables.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Table fields now show a compact summary (first row preview + table icon)
with the full rendered table appearing on hover via Tooltip component,
consistent with the existing overflow tooltip behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>