mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
修复语音的token获取问题
This commit is contained in:
parent
eb7a09c6f0
commit
f2fe5ad4c1
@ -1,6 +1,5 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
|
import { getSession } from "@/lib/auth";
|
||||||
import * as ms_audio_sdk from "microsoft-cognitiveservices-speech-sdk";
|
|
||||||
import { getServerSideConfig } from "@/app/config/server";
|
import { getServerSideConfig } from "@/app/config/server";
|
||||||
const serverConfig = getServerSideConfig();
|
const serverConfig = getServerSideConfig();
|
||||||
// Gets an access token.
|
// Gets an access token.
|
||||||
@ -13,7 +12,6 @@ async function getAccessToken() {
|
|||||||
},
|
},
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
};
|
};
|
||||||
console.log(options);
|
|
||||||
return await fetch(uri, options);
|
return await fetch(uri, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,6 +19,12 @@ async function handle(
|
|||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { path: string[] } },
|
{ params }: { params: { path: string[] } },
|
||||||
) {
|
) {
|
||||||
|
// 认证
|
||||||
|
|
||||||
|
const session = await getSession();
|
||||||
|
if (!session?.user)
|
||||||
|
return NextResponse.json({ error: "未认证" }, { status: 401 });
|
||||||
|
|
||||||
const get_access_token = await getAccessToken();
|
const get_access_token = await getAccessToken();
|
||||||
|
|
||||||
if (!get_access_token.ok) {
|
if (!get_access_token.ok) {
|
||||||
|
Loading…
Reference in New Issue
Block a user