mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-03 10:00:22 +08:00
fix(validation): extract schema to shared file for client/server compatibility
Move ValidationResultSchema to lib/validation-schema.ts to avoid importing server-side modules (ai-providers) into client-side code. This fixes the Turbopack build error caused by the hook importing from the API route.
This commit is contained in:
@@ -6,18 +6,13 @@
|
||||
|
||||
import { experimental_useObject as useObject } from "@ai-sdk/react"
|
||||
import { useCallback, useRef } from "react"
|
||||
import { ValidationResultSchema } from "@/app/api/validate-diagram/route"
|
||||
import { getApiEndpoint } from "@/lib/base-path"
|
||||
import {
|
||||
type ValidationResult,
|
||||
ValidationResultSchema,
|
||||
} from "@/lib/validation-schema"
|
||||
|
||||
export type ValidationResult = {
|
||||
valid: boolean
|
||||
issues: Array<{
|
||||
type: "overlap" | "edge_routing" | "text" | "layout" | "rendering"
|
||||
severity: "critical" | "warning"
|
||||
description: string
|
||||
}>
|
||||
suggestions: string[]
|
||||
}
|
||||
export type { ValidationResult }
|
||||
|
||||
// Default valid result for fallback cases
|
||||
const DEFAULT_VALID_RESULT: ValidationResult = {
|
||||
|
||||
Reference in New Issue
Block a user