feat(server): persist node semantic context and retain CAD agent context
Add a semantic_context column to canvas_nodes (schema, sqlc queries, generated models, repository upserts) and thread SemanticContext through the domain node, API type, and mappers so CAD-derived context survives canvas saves. Treat agent text parts with textSource "cad-context" like settings: keep them for planning, memory, and image-generation prompts but exclude them from the persisted user-visible message copy. Add coverage for the CAD context visibility and mapper behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,7 +114,7 @@ SET thumbnail = $3,
|
||||
WHERE id = $1 AND user_id = $2;
|
||||
|
||||
-- name: ListNodesByProject :many
|
||||
SELECT id, project_id, user_id, node_type, title, x, y, width, height, content, tone, status, sort_order, parent_id, layer_role, font_size, font_family, font_weight, color, text_align, line_height, letter_spacing, text_decoration, text_transform, opacity, fill_color, stroke_color, stroke_width, stroke_style, flip_x, flip_y, rotation
|
||||
SELECT id, project_id, user_id, node_type, title, x, y, width, height, content, tone, status, sort_order, parent_id, layer_role, font_size, font_family, font_weight, color, text_align, line_height, letter_spacing, text_decoration, text_transform, opacity, fill_color, stroke_color, stroke_width, stroke_style, flip_x, flip_y, rotation, semantic_context
|
||||
FROM canvas_nodes
|
||||
WHERE project_id = $1 AND user_id = $2
|
||||
ORDER BY sort_order ASC, id ASC;
|
||||
@@ -124,8 +124,8 @@ DELETE FROM canvas_nodes
|
||||
WHERE project_id = $1 AND user_id = $2;
|
||||
|
||||
-- name: UpsertCanvasNode :exec
|
||||
INSERT INTO canvas_nodes (id, project_id, user_id, node_type, title, x, y, width, height, content, tone, status, sort_order, parent_id, layer_role, font_size, font_family, font_weight, color, text_align, line_height, letter_spacing, text_decoration, text_transform, opacity, fill_color, stroke_color, stroke_width, stroke_style, flip_x, flip_y, rotation)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32)
|
||||
INSERT INTO canvas_nodes (id, project_id, user_id, node_type, title, x, y, width, height, content, tone, status, sort_order, parent_id, layer_role, font_size, font_family, font_weight, color, text_align, line_height, letter_spacing, text_decoration, text_transform, opacity, fill_color, stroke_color, stroke_width, stroke_style, flip_x, flip_y, rotation, semantic_context)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
project_id = EXCLUDED.project_id,
|
||||
user_id = EXCLUDED.user_id,
|
||||
@@ -157,7 +157,8 @@ ON CONFLICT (id) DO UPDATE SET
|
||||
stroke_style = EXCLUDED.stroke_style,
|
||||
flip_x = EXCLUDED.flip_x,
|
||||
flip_y = EXCLUDED.flip_y,
|
||||
rotation = EXCLUDED.rotation;
|
||||
rotation = EXCLUDED.rotation,
|
||||
semantic_context = EXCLUDED.semantic_context;
|
||||
|
||||
-- name: ListConnectionsByProject :many
|
||||
SELECT id, project_id, user_id, from_node_id, to_node_id
|
||||
|
||||
Reference in New Issue
Block a user