fix: temporarily remove botid from demo (#1438)
This commit is contained in:
parent
314f8ced57
commit
5c941dd830
6 changed files with 3 additions and 51 deletions
|
|
@ -7,7 +7,6 @@ import {
|
||||||
stepCountIs,
|
stepCountIs,
|
||||||
streamText,
|
streamText,
|
||||||
} from "ai";
|
} from "ai";
|
||||||
import { checkBotId } from "botid/server";
|
|
||||||
import { after } from "next/server";
|
import { after } from "next/server";
|
||||||
import { createResumableStreamContext } from "resumable-stream";
|
import { createResumableStreamContext } from "resumable-stream";
|
||||||
import { auth, type UserType } from "@/app/(auth)/auth";
|
import { auth, type UserType } from "@/app/(auth)/auth";
|
||||||
|
|
@ -64,14 +63,7 @@ export async function POST(request: Request) {
|
||||||
const { id, message, messages, selectedChatModel, selectedVisibilityType } =
|
const { id, message, messages, selectedChatModel, selectedVisibilityType } =
|
||||||
requestBody;
|
requestBody;
|
||||||
|
|
||||||
const [botResult, session] = await Promise.all([
|
const session = await auth();
|
||||||
checkBotId().catch(() => null),
|
|
||||||
auth(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (botResult?.isBot) {
|
|
||||||
return new ChatbotError("unauthorized:chat").toResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!session?.user) {
|
if (!session?.user) {
|
||||||
return new ChatbotError("unauthorized:chat").toResponse();
|
return new ChatbotError("unauthorized:chat").toResponse();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1 @@
|
||||||
import { initBotId } from "botid/client/core";
|
export {};
|
||||||
|
|
||||||
initBotId({
|
|
||||||
protect: [
|
|
||||||
{
|
|
||||||
path: `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/chat`,
|
|
||||||
method: "POST",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { withBotId } from "botid/next/config";
|
|
||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const basePath = "/demo";
|
const basePath = "/demo";
|
||||||
|
|
@ -25,4 +24,4 @@ const nextConfig: NextConfig = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withBotId(nextConfig);
|
export default nextConfig;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@
|
||||||
"@xyflow/react": "^12.10.0",
|
"@xyflow/react": "^12.10.0",
|
||||||
"ai": "6.0.37",
|
"ai": "6.0.37",
|
||||||
"bcrypt-ts": "^5.0.2",
|
"bcrypt-ts": "^5.0.2",
|
||||||
"botid": "1.5.6",
|
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"classnames": "^2.5.1",
|
"classnames": "^2.5.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
|
|
||||||
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
|
|
@ -101,9 +101,6 @@ importers:
|
||||||
bcrypt-ts:
|
bcrypt-ts:
|
||||||
specifier: ^5.0.2
|
specifier: ^5.0.2
|
||||||
version: 5.0.3
|
version: 5.0.3
|
||||||
botid:
|
|
||||||
specifier: 1.5.6
|
|
||||||
version: 1.5.6(next@16.0.10(@opentelemetry/api@1.9.0)(@playwright/test@1.51.0)(react-dom@19.0.1(react@19.0.1))(react@19.0.1))(react@19.0.1)
|
|
||||||
class-variance-authority:
|
class-variance-authority:
|
||||||
specifier: ^0.7.1
|
specifier: ^0.7.1
|
||||||
version: 0.7.1
|
version: 0.7.1
|
||||||
|
|
@ -2507,17 +2504,6 @@ packages:
|
||||||
resolution: {integrity: sha512-2FcgD12xPbwCoe5i9/HK0jJ1xA1m+QfC1e6htG9Bl/hNOnLyaFmQSlqLKcfe3QdnoMPKpKEGFCbESBTg+SJNOw==}
|
resolution: {integrity: sha512-2FcgD12xPbwCoe5i9/HK0jJ1xA1m+QfC1e6htG9Bl/hNOnLyaFmQSlqLKcfe3QdnoMPKpKEGFCbESBTg+SJNOw==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
botid@1.5.6:
|
|
||||||
resolution: {integrity: sha512-KElecPjc1z6WJ6sCJMw6CvLo/CQclwlLJdobqmtOjVqvCXZZmaWvNafVDwBk0Kf5ordIaorDa3YkIx2OlGx7pg==}
|
|
||||||
peerDependencies:
|
|
||||||
next: '*'
|
|
||||||
react: ^18.0.0 || ^19.0.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
next:
|
|
||||||
optional: true
|
|
||||||
react:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
buffer-from@1.1.2:
|
buffer-from@1.1.2:
|
||||||
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
||||||
|
|
||||||
|
|
@ -5990,11 +5976,6 @@ snapshots:
|
||||||
|
|
||||||
bcrypt-ts@5.0.3: {}
|
bcrypt-ts@5.0.3: {}
|
||||||
|
|
||||||
botid@1.5.6(next@16.0.10(@opentelemetry/api@1.9.0)(@playwright/test@1.51.0)(react-dom@19.0.1(react@19.0.1))(react@19.0.1))(react@19.0.1):
|
|
||||||
optionalDependencies:
|
|
||||||
next: 16.0.10(@opentelemetry/api@1.9.0)(@playwright/test@1.51.0)(react-dom@19.0.1(react@19.0.1))(react@19.0.1)
|
|
||||||
react: 19.0.1
|
|
||||||
|
|
||||||
buffer-from@1.1.2: {}
|
buffer-from@1.1.2: {}
|
||||||
|
|
||||||
bufferutil@4.0.9:
|
bufferutil@4.0.9:
|
||||||
|
|
|
||||||
10
vercel.json
10
vercel.json
|
|
@ -1,15 +1,5 @@
|
||||||
{
|
{
|
||||||
"framework": "nextjs",
|
"framework": "nextjs",
|
||||||
"rewrites": [
|
|
||||||
{
|
|
||||||
"source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/a-4-a/c.js",
|
|
||||||
"destination": "https://api.vercel.com/bot-protection/v1/challenge"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
|
|
||||||
"destination": "https://api.vercel.com/bot-protection/v1/proxy/:path*"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"redirects": [
|
"redirects": [
|
||||||
{
|
{
|
||||||
"source": "/",
|
"source": "/",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue