VoiceConsistency.h header
#include <ew/app/VoiceConsistency.h>
Namespace ew::app
Functions
app::ai::AiRequest ew::app::ai::knowledge::buildVoiceConsistencyRequest(const QString &passage, const QString &voiceSample)
Builds an AI request that checks whether passage matches the established voice and style of a manuscript, using voiceSample (prose drawn from elsewhere in the manuscript) as the reference. The model is asked to act as a line editor and report specific voice/style inconsistencies – shifts in tone, tense, person, diction, or sentence rhythm – with brief suggestions, or to confirm the voice is consistent; it is told not to rewrite the whole passage. This backs DESIGN §4.8 "maintain style/voice", and is distinct from the canon-fact consistency check (facts) and the rule-based style engine (mechanical issues).
Pure (assembles the prompt only; the reply is advisory prose, so no parse is needed); the caller fills the model from settings and sends it via an AiProvider. The model name is left empty.
QString ew::app::ai::knowledge::buildVoiceSample(const ew::core::project::Project &project, ew::core::foundation::ContentId exclude)
The reference voice sample for buildVoiceConsistencyRequest: the prose of every document in project except exclude (the document being checked), in project order, separated by blank lines.
Each body is reduced to plain prose, so an editor-authored HTML body contributes its writing rather than its markup, and an empty legacy stub – whose body is still a DOCTYPE, head and style block – contributes nothing. Documents the writer opted out of AI (ew::core::content::ContentObject::aiExcluded) are skipped: this sample is sent to the configured provider, so an opted-out document must never reach it. An empty result means there is no other prose to compare against.