v2.5.3 — Fix duplicate portrait + anti-repetition tags
- portraitAdded guard prevents duplicate image in chat - Negative prompt: multiple views, split screen, repetition, duplicate - Removed cowboy shot (caused repetition) - Clean gender tags: 1girl, solo (no trailing comma) - Steps 35, CFG 6.5 for better NoobAI-XL quality - Image max-width 400px in chat
This commit is contained in:
+5
-3
@@ -321,12 +321,14 @@
|
||||
|
||||
if (data.job_id) {
|
||||
const jobId = data.job_id;
|
||||
let portraitAdded = false; // Guard against duplicate insertion
|
||||
const pollInterval = setInterval(async () => {
|
||||
try {
|
||||
const statusResp = await fetch(`/api/portrait/status/${jobId}`);
|
||||
const statusData = await statusResp.json();
|
||||
|
||||
if (statusData.status === 'done' && statusData.image) {
|
||||
if (statusData.status === 'done' && statusData.image && !portraitAdded) {
|
||||
portraitAdded = true; // Prevent duplicate
|
||||
clearInterval(pollInterval);
|
||||
const imgUrl = `${statusData.image}?t=${Date.now()}`;
|
||||
|
||||
@@ -334,13 +336,13 @@
|
||||
const avatarEl = document.querySelector('.avatar');
|
||||
avatarEl.innerHTML = `<img src="${imgUrl}" style="width: 100%; height: 100%; border-radius: 50%; object-fit: cover;">`;
|
||||
|
||||
// Also show the portrait in the chat as a message
|
||||
// Show portrait in chat as a message (only once!)
|
||||
const portraitMsg = document.createElement('div');
|
||||
portraitMsg.className = 'msg msg-bot';
|
||||
portraitMsg.style.padding = '0';
|
||||
portraitMsg.style.overflow = 'hidden';
|
||||
portraitMsg.innerHTML = `
|
||||
<img src="${imgUrl}" style="width: 100%; max-width: 300px; border-radius: 16px 16px 16px 4px; display: block;">
|
||||
<img src="${imgUrl}" style="width: 100%; max-width: 400px; border-radius: 16px 16px 16px 4px; display: block;">
|
||||
<div style="padding: 8px 12px; font-size: 0.8rem; color: var(--muted);">🖼️ Neues Portrait generiert</div>
|
||||
`;
|
||||
chat.appendChild(portraitMsg);
|
||||
|
||||
Reference in New Issue
Block a user