rebrand ai-chatbot to openchat across app and api (#1418)
This commit is contained in:
parent
9d5d8a3ea7
commit
f7b6b55a8b
17 changed files with 90 additions and 90 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import type { NextRequest } from "next/server";
|
||||
import { auth } from "@/app/(auth)/auth";
|
||||
import { deleteAllChatsByUserId, getChatsByUserId } from "@/lib/db/queries";
|
||||
import { ChatSDKError } from "@/lib/errors";
|
||||
import { OpenChatError } from "@/lib/errors";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const { searchParams } = request.nextUrl;
|
||||
|
|
@ -11,7 +11,7 @@ export async function GET(request: NextRequest) {
|
|||
const endingBefore = searchParams.get("ending_before");
|
||||
|
||||
if (startingAfter && endingBefore) {
|
||||
return new ChatSDKError(
|
||||
return new OpenChatError(
|
||||
"bad_request:api",
|
||||
"Only one of starting_after or ending_before can be provided."
|
||||
).toResponse();
|
||||
|
|
@ -20,7 +20,7 @@ export async function GET(request: NextRequest) {
|
|||
const session = await auth();
|
||||
|
||||
if (!session?.user) {
|
||||
return new ChatSDKError("unauthorized:chat").toResponse();
|
||||
return new OpenChatError("unauthorized:chat").toResponse();
|
||||
}
|
||||
|
||||
const chats = await getChatsByUserId({
|
||||
|
|
@ -37,7 +37,7 @@ export async function DELETE() {
|
|||
const session = await auth();
|
||||
|
||||
if (!session?.user) {
|
||||
return new ChatSDKError("unauthorized:chat").toResponse();
|
||||
return new OpenChatError("unauthorized:chat").toResponse();
|
||||
}
|
||||
|
||||
const result = await deleteAllChatsByUserId({ userId: session.user.id });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue