Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Trim the text we get from transcriptions (#2457)

Oleg Isonenf8d4eb88bc42
diff --git a/apps/builder/app/routes/rest.ai.audio.transcriptions.ts b/apps/builder/app/routes/rest.ai.audio.transcriptions.ts
index a1b181ae1b..6fc5b00314 100644
--- a/apps/builder/app/routes/rest.ai.audio.transcriptions.ts
+++ b/apps/builder/app/routes/rest.ai.audio.transcriptions.ts
@@ -18,24 +18,25 @@ export const action = async ({ request }: ActionArgs) => {
);
if (response.ok === false) {
- const txt = await response.text();
+ const message = await response.text();
// eslint-disable-next-line no-console
- console.error("ERROR", response.status, txt);
+ console.error("ERROR", response.status, message);
return {
success: false,
error: {
status: response.status,
- message: txt,
+ message,
},
};
}
+ // @todo untyped
const data = await response.json();
return {
success: true,
- text: data.text,
+ text: data.text.trim(),
};
};