enzostvs HF Staff commited on
Commit
8fc01e0
·
1 Parent(s): dfb78a4

autoclose tag

Browse files
Files changed (1) hide show
  1. src/components/ask-ai/ask-ai.tsx +13 -1
src/components/ask-ai/ask-ai.tsx CHANGED
@@ -181,6 +181,18 @@ function AskAI({
181
  if (newHtml) {
182
  setIsThinking(false);
183
  let partialDoc = newHtml;
 
 
 
 
 
 
 
 
 
 
 
 
184
  if (!partialDoc.includes("</html>")) {
185
  partialDoc += "\n</html>";
186
  }
@@ -273,7 +285,7 @@ function AskAI({
273
  )}
274
  >
275
  {isAiWorking && (
276
- <div className="absolute bg-neutral-800 rounded-lg bottom-0 left-10 w-[calc(100%-92px)] h-full z-1 flex items-center justify-start max-lg:text-sm">
277
  <p className="text-neutral-400 font-code">
278
  AI is {isThinking ? "thinking" : "coding"}...
279
  </p>
 
181
  if (newHtml) {
182
  setIsThinking(false);
183
  let partialDoc = newHtml;
184
+ if (
185
+ partialDoc.includes("<head>") &&
186
+ !partialDoc.includes("</head>")
187
+ ) {
188
+ partialDoc += "\n</head>";
189
+ }
190
+ if (
191
+ partialDoc.includes("<body") &&
192
+ !partialDoc.includes("</body>")
193
+ ) {
194
+ partialDoc += "\n</body>";
195
+ }
196
  if (!partialDoc.includes("</html>")) {
197
  partialDoc += "\n</html>";
198
  }
 
285
  )}
286
  >
287
  {isAiWorking && (
288
+ <div className="absolute bg-neutral-800 rounded-lg bottom-0 left-11 w-[calc(100%-92px)] h-full z-1 flex items-center justify-start max-lg:text-sm">
289
  <p className="text-neutral-400 font-code">
290
  AI is {isThinking ? "thinking" : "coding"}...
291
  </p>