# Current State Audit

## Target Outcome

The target image style is:

- ultra-photorealistic
- luxury product photography
- shallow depth of field
- warm cinematic indoor lighting
- premium object styling
- realistic textures and reflections
- emotionally warm and expensive feeling

The quality bar is defined by:

- reference image: [problems/wine.png](/Users/bitmaster/Development/AppFactory/ai_menu_translator/problems/wine.png)
- reference prompt: [problems/prompt.md](/Users/bitmaster/Development/AppFactory/ai_menu_translator/problems/prompt.md)

## What The Live Pipeline Does Today

### 1. n8n still frames the job as a poster generator

File: `automation/n8n_ai_image_generator.json`

Current behavior:

- The webhook validates fields like `type`, `title`, `context`, `content`, and `language`.
- `type` is mapped to one of `offer`, `event`, or `menu`.
- The code node builds prompts around:
  - poster hierarchy
  - readable text
  - mobile layout
  - restaurant branding
  - poster content inclusion

Problem:

- This is structurally optimized for text-bearing restaurant posters, not for realistic product-photo composition.
- Even when the prompt says `ultrarealistic`, the rest of the prompt keeps pulling the model back toward a designed poster with typography.

### 2. The Python service is realism-aware but not realism-locked

File: `app/services/generate_ai_image/service.py`

Current behavior:

- Uses `responses.create(...)` with the `image_generation` tool.
- Builds a system prompt and user prompt from request fields.
- Adds generic realism instructions:
  - ultrarealistic
  - photo-realistic
  - avoid cartoon/painting/CGI-looking styles
- Treats the first image as logo and later images as reference images.

Problem:

- The service does not enforce a fixed scene grammar like the one in `problems/prompt.md`.
- It does not distinguish between:
  - poster generation
  - realistic product photo generation
- It does not validate whether visible text should be omitted entirely for photo-only outputs.

### 3. The request contract is too generic

File: `app/services/generate_ai_image/models/requests.py`

Current behavior:

- Accepts `system_prompt`, `user_prompt`, `language`, `content`, `logo_image_url`, and optional references.
- Does not define an explicit generation mode.
- Does not define a realism profile, composition profile, or negative prompt block.

Problem:

- Callers can send inconsistent prompts.
- n8n can keep generating poster-oriented requests even if the backend becomes stricter.

### 4. Config defaults do not describe the desired image category

File: `config/services/generate_ai_image.yaml`

Current behavior:

- Uses `gpt-5.5`
- Size `1024x1280`
- Quality `high`

Problem:

- The config carries transport defaults only.
- There is no documented default generation profile like `luxury_photorealistic_gift`.

### 5. Tests only cover API wiring, not image-style intent

File: `tests/services/test_generate_ai_image_service.py`

Current behavior:

- Verifies the Responses API call shape.
- Verifies basic language and reference-image instructions are present.

Problem:

- No test asserts that the built prompt contains:
  - scene breakdown
  - lighting requirements
  - texture requirements
  - lens / photography direction
  - negative prompt
  - explicit suppression of synthetic poster design when realism mode is active

## Main Gaps

1. The workflow entrypoint still thinks in poster terms.
2. The backend prompt builder is too generic.
3. There is no single canonical realism prompt contract.
4. There is no mode separation between text-heavy posters and text-free photorealistic compositions.
5. There are no acceptance checks against the exact look you want.

## Required Direction

The pipeline needs a first-class mode that behaves like this:

- input intent: realistic luxury product photo or realistic styled scene
- prompt source of truth: fixed template derived from `problems/prompt.md`
- text behavior: optional or disabled by default
- composition behavior: photo composition first, typography second
- reference usage: mandatory when provided
- regression protection: tests must fail if the prompt falls back to generic poster language
