From dba680c5c71d1103d52af7898a293c591dc9ca9f Mon Sep 17 00:00:00 2001 From: meet Date: Mon, 7 Oct 2024 18:43:45 +0530 Subject: [PATCH] Fixed the Gemini response with the help of .replace in js --- backend/src/routes/post/controller.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/routes/post/controller.ts b/backend/src/routes/post/controller.ts index 4235c03..cd43eaa 100644 --- a/backend/src/routes/post/controller.ts +++ b/backend/src/routes/post/controller.ts @@ -711,8 +711,8 @@ export const aiCustomization = async (req: UserAuthRequest, res: Response) => { const cssResponse = await cssResult.response; const jsResponse = await jsResult.response; - const cssText = cssResponse.text(); - const jsText = jsResponse.text(); + const cssText = cssResponse.text().replace('```html','').replace('```',''); + const jsText = jsResponse.text().replace('```javascript','').replace('```',''); res.json({ css: cssText, js: jsText });