|
1 | | -import crypto from 'node:crypto' |
| 1 | +import { randomUUID } from 'crypto' |
2 | 2 | import { and, desc, eq, inArray, isNull, sql } from 'drizzle-orm' |
3 | 3 | import { type NextRequest, NextResponse } from 'next/server' |
4 | 4 | import { z } from 'zod' |
@@ -114,7 +114,7 @@ async function processDocumentTags( |
114 | 114 | // Create new tag definition if we have a slot |
115 | 115 | if (targetSlot) { |
116 | 116 | const newDefinition = { |
117 | | - id: crypto.randomUUID(), |
| 117 | + id: randomUUID(), |
118 | 118 | knowledgeBaseId, |
119 | 119 | tagSlot: targetSlot as any, |
120 | 120 | displayName: tagName, |
@@ -312,7 +312,7 @@ const BulkUpdateDocumentsSchema = z.object({ |
312 | 312 | }) |
313 | 313 |
|
314 | 314 | export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { |
315 | | - const requestId = crypto.randomUUID().slice(0, 8) |
| 315 | + const requestId = randomUUID().slice(0, 8) |
316 | 316 | const { id: knowledgeBaseId } = await params |
317 | 317 |
|
318 | 318 | try { |
@@ -423,7 +423,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ id: |
423 | 423 | } |
424 | 424 |
|
425 | 425 | export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { |
426 | | - const requestId = crypto.randomUUID().slice(0, 8) |
| 426 | + const requestId = randomUUID().slice(0, 8) |
427 | 427 | const { id: knowledgeBaseId } = await params |
428 | 428 |
|
429 | 429 | try { |
@@ -470,7 +470,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: |
470 | 470 |
|
471 | 471 | const createdDocuments = await db.transaction(async (tx) => { |
472 | 472 | const documentPromises = validatedData.documents.map(async (docData) => { |
473 | | - const documentId = crypto.randomUUID() |
| 473 | + const documentId = randomUUID() |
474 | 474 | const now = new Date() |
475 | 475 |
|
476 | 476 | // Process documentTagsData if provided (for knowledge base block) |
@@ -578,7 +578,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: |
578 | 578 | try { |
579 | 579 | const validatedData = CreateDocumentSchema.parse(body) |
580 | 580 |
|
581 | | - const documentId = crypto.randomUUID() |
| 581 | + const documentId = randomUUID() |
582 | 582 | const now = new Date() |
583 | 583 |
|
584 | 584 | // Process structured tag data if provided |
|
0 commit comments