feat: enhance canvas functionality with proximity edge handling and improved authentication logging

- Introduced temporary edge styling for proximity connections in the canvas.
- Updated edge synchronization logic to filter out temporary edges during data processing.
- Enhanced authentication logging to provide detailed user identity information when authentication fails.
- Added a new utility function for sanitizing edge handle IDs to ensure compatibility with React Flow.
- Implemented a node handle mapping for proximity connections to streamline edge management.
This commit is contained in:
Matthias
2026-03-26 10:57:10 +01:00
parent 5e99e8cfde
commit 824939307c
5 changed files with 398 additions and 18 deletions

View File

@@ -29,17 +29,40 @@ export function convexNodeToRF(node: Doc<"nodes">): RFNode {
/**
* Convex Edge → React Flow Edge
* Sanitize handles: null/undefined/"null" → undefined (ReactFlow erwartet string | null | undefined, aber nie den String "null")
*/
export function convexEdgeToRF(edge: Doc<"edges">): RFEdge {
const sanitize = (h: string | undefined): string | undefined =>
h === undefined || h === "null" ? undefined : h;
// #region agent log
fetch('http://127.0.0.1:7733/ingest/db1ec129-24cb-483b-98e2-3e7beef6d9cd',{method:'POST',headers:{'Content-Type':'application/json','X-Debug-Session-Id':'594b9f'},body:JSON.stringify({sessionId:'594b9f',runId:'run1',hypothesisId:'H1-H3-H4',location:'canvas-utils.ts:convexEdgeToRF',message:'raw edge from convex',data:{edgeId:edge._id,sourceNodeId:edge.sourceNodeId,targetNodeId:edge.targetNodeId,rawSourceHandle:edge.sourceHandle,rawTargetHandle:edge.targetHandle,typeofSourceHandle:typeof edge.sourceHandle,typeofTargetHandle:typeof edge.targetHandle,isNullSH:edge.sourceHandle===null,isNullTH:edge.targetHandle===null,isUndefinedSH:edge.sourceHandle===undefined,isUndefinedTH:edge.targetHandle===undefined,isStringNullSH:edge.sourceHandle==='null',isStringNullTH:edge.targetHandle==='null',sanitizedSH:sanitize(edge.sourceHandle),sanitizedTH:sanitize(edge.targetHandle)},timestamp:Date.now()})}).catch(()=>{});
// #endregion
return {
id: edge._id,
source: edge.sourceNodeId,
target: edge.targetNodeId,
sourceHandle: edge.sourceHandle ?? undefined,
targetHandle: edge.targetHandle ?? undefined,
sourceHandle: sanitize(edge.sourceHandle),
targetHandle: sanitize(edge.targetHandle),
};
}
/**
* Handle-IDs pro Node-Typ für Proximity Connect.
* `undefined` = default handle (kein explizites `id`-Attribut auf dem Handle).
* Fehlendes Feld = Node hat keinen Handle dieses Typs.
*/
export const NODE_HANDLE_MAP: Record<
string,
{ source?: string; target?: string }
> = {
image: { source: undefined },
text: { source: undefined },
prompt: { source: "prompt-out", target: "image-in" },
"ai-image": { source: "image-out", target: "prompt-in" },
frame: { source: "frame-out", target: "frame-in" },
compare: { target: "left" },
};
/**
* Default-Größen für neue Nodes je nach Typ.
*/