Preserve full draft sections and disclose missing requested content
This commit is contained in:
@@ -38,6 +38,7 @@ const OfferAssistantSession = ({ tender }) => {
|
||||
const [denetim, setDenetim] = useState(null);
|
||||
const [tur, setTur] = useState('tam');
|
||||
const [bolumler, setBolumler] = useState([]);
|
||||
const [draftReview, setDraftReview] = useState(null);
|
||||
const [mesgul, setMesgul] = useState(false);
|
||||
const [hata, setHata] = useState(null);
|
||||
|
||||
@@ -58,7 +59,7 @@ const OfferAssistantSession = ({ tender }) => {
|
||||
});
|
||||
const uret = () => calistir(async () => {
|
||||
const result = await post('/api/ai/teklif-taslak', {ikn:tender.ikn, tur, tender, text:metin || undefined}, listDocuments);
|
||||
if (current()) setBolumler(result.bolumler || []);
|
||||
if (current()) { setBolumler(result.bolumler || []); setDraftReview(result.draftReview || null); }
|
||||
});
|
||||
const kopyala = (t) => { if (current()) navigator.clipboard?.writeText(t).catch(() => {}); };
|
||||
const dosyaOku = (f) => {
|
||||
@@ -154,6 +155,12 @@ const OfferAssistantSession = ({ tender }) => {
|
||||
</button>
|
||||
{bolumler.length > 0 && <button type="button" onClick={() => kopyala(bolumler.map((b) => `${b.baslik}\n\n${b.icerik}`).join('\n\n\n'))} className="text-xs text-slate-600 border border-slate-200 rounded-lg px-2 py-1.5 flex items-center gap-1 hover:bg-slate-50"><Copy className="w-3.5 h-3.5" /> Tümünü kopyala</button>}
|
||||
</div>
|
||||
{draftReview && <div role="status" className="rounded-lg border border-amber-200 bg-amber-50 p-3 text-xs text-amber-900">
|
||||
<p className="font-semibold">{draftReview.status === 'partial' ? 'Kısmi taslak — bölüm kontrolü gerekli' : 'Taslak — kullanıcı kontrolü gerekli'}</p>
|
||||
<p>{draftReview.note}</p>
|
||||
{draftReview.missingSections?.length > 0 && <p>Modelin tamamlamadığı bölümler: {draftReview.missingSections.join(', ')}. Aşağıdaki DOLDURUN alanlarını düzenleyin.</p>}
|
||||
{draftReview.extraSections?.length > 0 && <p>İstenen başlıklara eşleşmeyen ek bölümler: {draftReview.extraSections.join(', ')}.</p>}
|
||||
</div>}
|
||||
{bolumler.map((b, i) => (
|
||||
<div key={i} className="space-y-1">
|
||||
<input value={b.baslik} onChange={(e) => setBolumler((p) => p.map((x, k) => (k === i ? { ...x, baslik: e.target.value } : x)))} className="w-full border border-slate-200 rounded-lg px-2 py-1 text-sm font-bold" />
|
||||
|
||||
Reference in New Issue
Block a user