victor HF Staff commited on
Commit
9bb969b
·
1 Parent(s): cd8869a

chore: Enhance logging with prefixes and success message

Browse files
Files changed (1) hide show
  1. server.js +5 -3
server.js CHANGED
@@ -310,10 +310,10 @@ function applyDiffs(originalHtml, aiResponseContent) {
310
  // Heuristic: If the response looks like a full HTML doc, use it directly.
311
  const trimmedResponse = aiResponseContent.trim().toLowerCase();
312
  if (trimmedResponse.startsWith('<!doctype html') || trimmedResponse.startsWith('<html')) {
313
- console.warn("AI response seems to be full HTML despite diff instructions. Using full response.");
314
  return aiResponseContent;
315
  }
316
- console.warn("No diff blocks found and response doesn't look like full HTML. Returning original HTML.");
317
  return originalHtml; // Return original if no diffs and not full HTML
318
  }
319
 
@@ -527,8 +527,10 @@ ONLY output the changes in this format. Do NOT output the full HTML file again.`
527
 
528
  // Basic check if the streamed response looks like HTML
529
  if (!completeResponse.trim().toLowerCase().includes("</html>")) {
530
- console.warn("Streamed response might be incomplete or not valid HTML.");
531
  // Client side might handle this, but good to log.
 
 
532
  }
533
 
534
  res.end(); // End the stream
 
310
  // Heuristic: If the response looks like a full HTML doc, use it directly.
311
  const trimmedResponse = aiResponseContent.trim().toLowerCase();
312
  if (trimmedResponse.startsWith('<!doctype html') || trimmedResponse.startsWith('<html')) {
313
+ console.warn("[Diff Apply] AI response seems to be full HTML despite diff instructions. Using full response as fallback.");
314
  return aiResponseContent;
315
  }
316
+ console.warn("[Diff Apply] No valid diff blocks found and response doesn't look like full HTML. Returning original HTML.");
317
  return originalHtml; // Return original if no diffs and not full HTML
318
  }
319
 
 
527
 
528
  // Basic check if the streamed response looks like HTML
529
  if (!completeResponse.trim().toLowerCase().includes("</html>")) {
530
+ console.warn("[AI Request] Streamed response might be incomplete or not valid HTML.");
531
  // Client side might handle this, but good to log.
532
+ } else {
533
+ console.log("[AI Request] Stream finished successfully.");
534
  }
535
 
536
  res.end(); // End the stream