ConversionMediaMatch.h header

#include <ew/app/ConversionMediaMatch.h>

Namespace ew::app

ConvertedMediaMatch struct

struct ew::app::ConvertedMediaMatch

One image the conversion proposes to place: into a KNOWN entity's gallery (optionally as its cover, with a caption), or as the backdrop of a new Map. The AI never sees pixels – it matches by filename and the source text's context – and the parser enforces that the image is one the caller actually offered and the entity actually exists.

Members

QString ew::app::ConvertedMediaMatch::imagePath

The image's inventory-relative path (always one of the offered paths).

QString ew::app::ConvertedMediaMatch::entityName

The KNOWN entity whose gallery this image joins; empty for a plain media-library import (or when mapTitle routes it to a Map instead).

bool ew::app::ConvertedMediaMatch::asCover = false

Proposed as the entity's cover image (the first gallery slot). At most one image per entity survives with this set – the first wins.

QString ew::app::ConvertedMediaMatch::caption

A short caption (may be empty).

QString ew::app::ConvertedMediaMatch::mapTitle

When non-empty, the image is proposed as a NEW Map's backdrop under this title instead of a gallery placement (entityName/asCover are cleared by the parser in that case).

bool ew::app::ConvertedMediaMatch::operator==(const ConvertedMediaMatch &) const =default

Field-wise equality.

Functions

AiRequest ew::app::buildConversionMediaRequest(const QStringList &imagePaths, const QStringList &knownNames, const QString &sourceContext)

Builds the AI request asking the model to place imagePaths against knownNames using filenames and sourceContext (nearby text), as strict JSON for parseConversionMediaResponse. Pure; the caller sets the model and sends it.

std::vector< ConvertedMediaMatch > ew::app::parseConversionMediaResponse(const QString &content, const QStringList &imagePaths, const QStringList &knownNames)

Parses the model reply into placements. Safety rules the parser enforces: an entry whose image is not one of imagePaths is dropped (no invented files); an entityName not in knownNames clears to a plain library import; a mapTitle proposal clears entity/cover; duplicate images collapse to the first; a second cover for the same entity is demoted to a plain gallery placement. Returns empty when no well-formed array is present.