fix: Make coords_3d optional in schema to support UMAP workflow
The proper architecture is: 1. Nodes are created with coords_3d = NONE 2. User manually triggers /api/calculate-graph 3. UMAP calculates 3D coordinates from embeddings 4. Coordinates are updated in batch Changed coords_3d TYPE from array<number> to option<array<number>> to allow NONE values. This fixes production error: "Found NONE for field coords_3d but expected array<number>" Schema has been deployed to production. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -229,7 +229,7 @@ export async function POST(request: NextRequest) {
|
||||
atp_uri: atp_uri,
|
||||
title: title,
|
||||
body: body, // Store the raw text body
|
||||
coords_3d: [0, 0, 0], // Required by schema - origin coordinates for new nodes
|
||||
// coords_3d will be calculated when user runs /api/calculate-graph
|
||||
};
|
||||
|
||||
// Only include embedding if it was successfully generated
|
||||
|
||||
@@ -62,8 +62,9 @@ DEFINE FIELD body ON TABLE node TYPE string;
|
||||
DEFINE FIELD embedding ON TABLE node TYPE array<number>;
|
||||
|
||||
-- The 3D coordinates calculated by UMAP.
|
||||
DEFINE FIELD coords_3d ON TABLE node TYPE array<number>
|
||||
-- Must be a 3-point array [x, y, z] or empty.
|
||||
-- Nodes start with NONE and get coordinates when user runs calculate-graph.
|
||||
DEFINE FIELD coords_3d ON TABLE node TYPE option<array<number>>
|
||||
-- Must be NONE or a 3-point array [x, y, z].
|
||||
ASSERT $value = NONE OR array::len($value) = 3;
|
||||
|
||||
-- Define the vector search index.
|
||||
|
||||
Reference in New Issue
Block a user