Spaces:
Running
Running
refactor: Accumulate raw diff response instead of processing
Browse files
src/components/ask-ai/ask-ai.tsx
CHANGED
|
@@ -135,12 +135,10 @@ function AskAI({
|
|
| 135 |
|
| 136 |
if (responseType === 'diff') {
|
| 137 |
// --- Diff Mode ---
|
| 138 |
-
|
| 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;
|