AI Assistant 827a1e46ad refactor: Use provided structure for confirmation form HTML generation
Problem:
- User wants to use the provided n8n Code node structure for generating confirmation form HTML
- Current implementation doesn't match the expected structure

Solution:
1. Created separate file generateConfirmationFormHTML.ts:
   - Implements data normalization from propertyName format
   - Uses provided HTML template structure
   - Includes field creation functions (createField, createDateField, etc.)
   - Implements form rendering with editable inline fields
   - Handles form data binding and submission via postMessage

2. Updated StepClaimConfirmation component:
   - Imports generateConfirmationFormHTML from separate file
   - Removed old inline HTML generation function
   - Uses new structure-based generation

3. Data normalization:
   - Transforms propertyName structure to form structure
   - Maps applicant fields: first_name -> firstname
   - Maps contract_or_service fields to project
   - Maps claim fields to project (description, reason)
   - Handles attachments and offenders arrays

4. Form features:
   - Inline editable fields in statement text
   - Date fields with calendar picker
   - Money fields with рублей suffix
   - Readonly fields for phone and category
   - Form data collection and submission

Files:
- frontend/src/components/form/generateConfirmationFormHTML.ts: New file with form generation logic
- frontend/src/components/form/StepClaimConfirmation.tsx: Updated to use new generator
2025-11-24 15:32:08 +03:00

🚀 Ticket Form Intake Platform

Платформа цифровой приёмки обращений для other.clientright.ru

  • Backend: Python FastAPI (async)
  • Frontend: React 18 + TypeScript
  • Database: PostgreSQL + MySQL + Redis
  • Queue: RabbitMQ
  • Storage: S3 Timeweb Cloud

🎯 Быстрый старт

📍 Визуальный доступ:

После запуска доступны по адресам:

Frontend (форма):
http://147.45.146.17:5175/

Backend API:
http://147.45.146.17:8200/

API Документация (Swagger UI):
http://147.45.146.17:8200/docs  ← Интерактивная!

Gitea (Git репозиторий):
http://147.45.146.17:3002/

🔧 Установка и запуск

Backend (FastAPI):

cd backend

# Создаём виртуальное окружение
python3 -m venv venv
source venv/bin/activate

# Устанавливаем зависимости
pip install -r requirements.txt

# Запускаем сервер
uvicorn app.main:app --reload --host 0.0.0.0 --port 8200

Frontend (React):

cd frontend

# Устанавливаем зависимости
npm install

# Запускаем dev сервер
npm run dev -- --host 0.0.0.0 --port 5175

📊 Архитектура

Поток данных:

React (5175) → FastAPI (8200) → [Redis, RabbitMQ, PostgreSQL]
                              ↓
                        OCR Service (8001)
                        OpenRouter AI
                        FlightAware API
                              ↓
                        PHP Bridge → Vtiger CRM

Что НЕ трогаем:

CRM Vtiger (работает как работала)
MySQL полисы (только READ)
Существующий PHP код


🗄️ Базы данных

База Назначение Хост
PostgreSQL Логи, метрики, новые данные 147.45.189.234:5432
MySQL Проверка полисов (READ) localhost:3306
Redis Кеш, Rate Limiting localhost:6379

📁 Структура проекта

ticket_form/
├─ backend/        ← Python FastAPI
│   ├─ app/
│   │   ├─ main.py
│   │   ├─ api/
│   │   ├─ services/
│   │   └─ models/
│   └─ requirements.txt
│
├─ frontend/       ← React TypeScript
│   ├─ src/
│   │   ├─ components/
│   │   ├─ pages/
│   │   └─ api/
│   └─ package.json
│
└─ .env           ← Конфигурация

🔌 API Endpoints

Документы:

  • POST /api/v1/documents/upload - Загрузка в S3
  • POST /api/v1/documents/scan - OCR + Vision

Рейсы:

  • GET /api/v1/flights/check - Проверка статуса

Обращения:

  • POST /api/v1/claims/submit - Создание обращения

Полисы:

  • GET /api/v1/policies/verify - Проверка полиса

🐛 Отладка

Логи:

# FastAPI
tail -f backend/logs/app.log

# PostgreSQL логи
SELECT * FROM logs ORDER BY created_at DESC LIMIT 50;

📝 Git

# Репозиторий
http://147.45.146.17:3002/negodiy/erv-platform

# Клонирование
git clone http://147.45.146.17:3002/negodiy/erv-platform.git

# Push изменений
git add .
git commit -m "Your message"
git push origin main

Автор: AI Assistant + Фёдор
Дата: 24.10.2025

Description
AI Form - Development версия для разработки и тестирования
Readme 1,002 KiB
Languages
TypeScript 61.3%
Python 33.9%
Shell 1.8%
PLpgSQL 1.3%
HTML 1.3%
Other 0.4%