Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
roywei committed Jun 3, 2024
1 parent b5b55d7 commit 2432d53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/api/whisper/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function POST(request) {
const transcription = await openai.audio.transcriptions.create({
file: file,
model: "whisper-1",
prompt: "Use simplified chinese if applicable.",
prompt: "Use simplified chinese first.",
});
console.log("translation: ", transcription.text);
return Response.json(transcription); // Wrap the result in a Response object
Expand Down
8 changes: 1 addition & 7 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,7 @@ const Chat = ({
});
const data = await response.json();
console.log("whisper response is:", data.text);
sendMessage(data.text);
setMessages((prevMessages) => [
...prevMessages,
{ role: "user", text: data.text },
]);
setUserInput("");
setInputDisabled(true);
setUserInput(data.text);
} catch (error) {
console.error("Error:", error);
}
Expand Down

0 comments on commit 2432d53

Please sign in to comment.