fix: explicit UTF-8 charset everywhere
This commit is contained in:
+5
-5
@@ -1217,7 +1217,7 @@ app.post("/api/deepseek/chat", requireAuth, async (req, res) => {
|
||||
const response = await fetch(DEEPSEEK_API_URL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
@@ -1279,7 +1279,7 @@ app.post("/api/deepseek/chat/stream", requireAuth, async (req, res) => {
|
||||
const response = await fetch(DEEPSEEK_API_URL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
@@ -1299,13 +1299,13 @@ app.post("/api/deepseek/chat/stream", requireAuth, async (req, res) => {
|
||||
}
|
||||
|
||||
// Set headers for SSE
|
||||
res.setHeader("Content-Type", "text/event-stream");
|
||||
res.setHeader("Content-Type", "text/event-stream; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
|
||||
// Pipe the stream
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
|
||||
const pump = async () => {
|
||||
try {
|
||||
@@ -1368,7 +1368,7 @@ app.post("/api/deepseek/translate", requireAuth, async (req, res) => {
|
||||
const response = await fetch(DEEPSEEK_API_URL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user