rename openchat branding to chatbot on demo (#1421)

This commit is contained in:
dancer 2026-02-23 17:24:17 -08:00 committed by GitHub
parent 72597d6f68
commit e7ef7d8f9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 161 additions and 127 deletions

View file

@ -1,13 +1,13 @@
import { auth } from "@/app/(auth)/auth";
import { getChatById, getVotesByChatId, voteMessage } from "@/lib/db/queries";
import { OpenChatError } from "@/lib/errors";
import { ChatbotError } from "@/lib/errors";
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const chatId = searchParams.get("chatId");
if (!chatId) {
return new OpenChatError(
return new ChatbotError(
"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 OpenChatError("unauthorized:vote").toResponse();
return new ChatbotError("unauthorized:vote").toResponse();
}
const chat = await getChatById({ id: chatId });
if (!chat) {
return new OpenChatError("not_found:chat").toResponse();
return new ChatbotError("not_found:chat").toResponse();
}
if (chat.userId !== session.user.id) {
return new OpenChatError("forbidden:vote").toResponse();
return new ChatbotError("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 OpenChatError(
return new ChatbotError(
"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 OpenChatError("unauthorized:vote").toResponse();
return new ChatbotError("unauthorized:vote").toResponse();
}
const chat = await getChatById({ id: chatId });
if (!chat) {
return new OpenChatError("not_found:vote").toResponse();
return new ChatbotError("not_found:vote").toResponse();
}
if (chat.userId !== session.user.id) {
return new OpenChatError("forbidden:vote").toResponse();
return new ChatbotError("forbidden:vote").toResponse();
}
await voteMessage({