brendmanager/src/mock-draft-writer.js

21 lines
842 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Мок вместо ИИ, который по постановке BRM-20 пишет черновик: ключа ИИ у проекта нет.
// Контракт настоящего автора тот же: write(card) → Promise<{ subject, body }>.
import { t } from "./i18n.js";
const LETTER_LANG = "ru"; // письма только на русском (решение BRM-20)
const day = (d) => d.split("-").reverse().join(".");
export const mockDraftWriter = {
async write(card) {
const L = LETTER_LANG;
return {
subject: t(L, "draft.subject", card),
body: t(L, "draft.body", {
...card,
topicLine: card.topic ? t(L, "draft.topic", card) : t(L, "draft.noTopic"),
deadlineLine: card.deadline ? t(L, "draft.deadline", { deadline: day(card.deadline) }) : "",
}),
};
},
};