mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
fix(web): Fix issue where creating a new Ask thread would result in a 404 (#641)
Some checks are pending
Publish to ghcr / merge (push) Blocked by required conditions
Publish to ghcr / build (linux/amd64, blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Publish to ghcr / build (linux/arm64, blacksmith-8vcpu-ubuntu-2204-arm) (push) Waiting to run
Update Roadmap Released / update (push) Waiting to run
Some checks are pending
Publish to ghcr / merge (push) Blocked by required conditions
Publish to ghcr / build (linux/amd64, blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Publish to ghcr / build (linux/arm64, blacksmith-8vcpu-ubuntu-2204-arm) (push) Waiting to run
Update Roadmap Released / update (push) Waiting to run
This commit is contained in:
parent
f1dd16be82
commit
92ae76168c
4 changed files with 10 additions and 5 deletions
|
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fixed issue where single quotes could not be used in search queries. [#629](https://github.com/sourcebot-dev/sourcebot/pull/629)
|
||||
- Fixed issue where files with special characters would fail to load. [#636](https://github.com/sourcebot-dev/sourcebot/issues/636)
|
||||
- Fixed Ask performance issues. [#632](https://github.com/sourcebot-dev/sourcebot/pull/632)
|
||||
- Fixed regression where creating a new Ask thread when unauthenticated would result in a 404. [#641](https://github.com/sourcebot-dev/sourcebot/pull/641)
|
||||
|
||||
## [4.10.0] - 2025-11-24
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
-- First, remove the NOT NULL constraint on the createdById column.
|
||||
ALTER TABLE "Chat" ALTER COLUMN "createdById" DROP NOT NULL;
|
||||
|
||||
-- Then, set all chats created by the guest user (id: 1) to have a NULL createdById.
|
||||
UPDATE "Chat" SET "createdById" = NULL WHERE "createdById" = '1';
|
||||
|
|
@ -437,8 +437,8 @@ model Chat {
|
|||
|
||||
name String?
|
||||
|
||||
createdBy User @relation(fields: [createdById], references: [id], onDelete: Cascade)
|
||||
createdById String
|
||||
createdBy User? @relation(fields: [createdById], references: [id], onDelete: Cascade)
|
||||
createdById String?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
'use server';
|
||||
|
||||
import { sew } from "@/actions";
|
||||
import { SOURCEBOT_GUEST_USER_ID } from "@/lib/constants";
|
||||
import { ErrorCode } from "@/lib/errorCodes";
|
||||
import { chatIsReadonly, notFound, ServiceError, serviceErrorResponse } from "@/lib/serviceError";
|
||||
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
||||
|
|
@ -34,13 +33,13 @@ const logger = createLogger('chat-actions');
|
|||
|
||||
export const createChat = async () => sew(() =>
|
||||
withOptionalAuthV2(async ({ org, user, prisma }) => {
|
||||
const isGuestUser = user?.id === SOURCEBOT_GUEST_USER_ID;
|
||||
const isGuestUser = user === undefined;
|
||||
|
||||
const chat = await prisma.chat.create({
|
||||
data: {
|
||||
orgId: org.id,
|
||||
messages: [] as unknown as Prisma.InputJsonValue,
|
||||
createdById: user?.id ?? SOURCEBOT_GUEST_USER_ID,
|
||||
createdById: user?.id,
|
||||
visibility: isGuestUser ? ChatVisibility.PUBLIC : ChatVisibility.PRIVATE,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue