victor HF Staff commited on
Commit
6bdf73d
·
1 Parent(s): a450a2d

refactor: Accumulate raw diff response instead of processing

Browse files
Files changed (1) hide show
  1. src/components/ask-ai/ask-ai.tsx +2 -4
src/components/ask-ai/ask-ai.tsx CHANGED
@@ -135,12 +135,10 @@ function AskAI({
135
 
136
  if (responseType === 'diff') {
137
  // --- Diff Mode ---
138
- currentDiffBuffer += chunk;
139
- const remaining = processDiffBuffer(currentDiffBuffer, editorRef.current);
140
- currentDiffBuffer = remaining; // Update local buffer with unprocessed part
141
  } else {
142
  // --- Full HTML Mode ---
143
- fullContentResponse += chunk;
144
  // Use regex to find the start of the HTML doc
145
  const newHtmlMatch = fullContentResponse.match(/<!DOCTYPE html>[\s\S]*/);
146
  const newHtml = newHtmlMatch ? newHtmlMatch[0] : null;
 
135
 
136
  if (responseType === 'diff') {
137
  // --- Diff Mode ---
138
+ accumulatedDiffResponse += chunk; // Just accumulate the raw response
 
 
139
  } else {
140
  // --- Full HTML Mode ---
141
+ fullContentResponse += chunk; // Accumulate for preview
142
  // Use regex to find the start of the HTML doc
143
  const newHtmlMatch = fullContentResponse.match(/<!DOCTYPE html>[\s\S]*/);
144
  const newHtml = newHtmlMatch ? newHtmlMatch[0] : null;