rebrand ai-chatbot to openchat across app and api (#1418)

This commit is contained in:
dancer 2026-02-20 15:28:40 -08:00 committed by GitHub
parent 9d5d8a3ea7
commit f7b6b55a8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 90 additions and 90 deletions

View file

@ -1,13 +1,13 @@
import { auth } from "@/app/(auth)/auth";
import { getChatById, getVotesByChatId, voteMessage } from "@/lib/db/queries";
import { ChatSDKError } from "@/lib/errors";
import { OpenChatError } from "@/lib/errors";
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const chatId = searchParams.get("chatId");
if (!chatId) {
return new ChatSDKError(
return new OpenChatError(
"bad_request:api",
"Parameter chatId is required."
).toResponse();
@ -16,17 +16,17 @@ export async function GET(request: Request) {
const session = await auth();
if (!session?.user) {
return new ChatSDKError("unauthorized:vote").toResponse();
return new OpenChatError("unauthorized:vote").toResponse();
}
const chat = await getChatById({ id: chatId });
if (!chat) {
return new ChatSDKError("not_found:chat").toResponse();
return new OpenChatError("not_found:chat").toResponse();
}
if (chat.userId !== session.user.id) {
return new ChatSDKError("forbidden:vote").toResponse();
return new OpenChatError("forbidden:vote").toResponse();
}
const votes = await getVotesByChatId({ id: chatId });
@ -43,7 +43,7 @@ export async function PATCH(request: Request) {
await request.json();
if (!chatId || !messageId || !type) {
return new ChatSDKError(
return new OpenChatError(
"bad_request:api",
"Parameters chatId, messageId, and type are required."
).toResponse();
@ -52,17 +52,17 @@ export async function PATCH(request: Request) {
const session = await auth();
if (!session?.user) {
return new ChatSDKError("unauthorized:vote").toResponse();
return new OpenChatError("unauthorized:vote").toResponse();
}
const chat = await getChatById({ id: chatId });
if (!chat) {
return new ChatSDKError("not_found:vote").toResponse();
return new OpenChatError("not_found:vote").toResponse();
}
if (chat.userId !== session.user.id) {
return new ChatSDKError("forbidden:vote").toResponse();
return new OpenChatError("forbidden:vote").toResponse();
}
await voteMessage({