mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 21:15:18 +09:00
fix: Trim the text we get from transcriptions (#2457)
## Description Whisper often returns lots of spaces before or after text, now we are trimming them ## Code Review - [ ] hi @istarkov , I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory
This commit is contained in:
1 parent
331cbea835
commit
f8d4eb88bc
1 file changed
+5
-4
@@ -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(),
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user