import type { AppConfig } from "../config.js"; import { groqChat } from "./groq.js"; /** * Tłumaczy wolną uwagę operatora o strukturze tkaniny (PL) na krótką * klauzulę EN trafiającą do promptu image-edit. Model tekstowy, * deterministycznie niska temperatura. Zwraca samą frazę, bez cudzysłowów. */ export async function translateFabricNote(cfg: AppConfig, notePl: string): Promise { const res = await groqChat(cfg, { model: cfg.groqTunerModel, reasoningEffort: "low", maxTokens: 80, temperature: 0.1, messages: [ { role: "system", content: "Translate the operator's Polish note about upholstery fabric into a short English material descriptor for an image-edit prompt. " + "Output ONLY the English phrase — lowercase noun phrases, comma-separated, no sentences, no quotes, no explanations. " + "Keep fabric-technical accuracy (weave, pile, ribs, loops, sheen).", }, { role: "user", content: notePl }, ], }); return res.text.trim().replace(/^["']|["'.]$/g, "").slice(0, 300); }