From 809a1d07412460915f2613c84b42f3c588145f29 Mon Sep 17 00:00:00 2001 From: Luis Novo Date: Fri, 16 Jan 2026 09:33:01 -0300 Subject: [PATCH] fix(api): correct embedded flag check in source listing (#439) Change embedded check from `!= NONE` to `!= []` because SurrealDB's SELECT VALUE returns an empty array [] when no results found, not NONE. The comparison `[] != NONE` evaluates to true, causing all sources to incorrectly show as embedded. Fixes #397 --- api/routers/sources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/routers/sources.py b/api/routers/sources.py index 22c8624..78545e8 100644 --- a/api/routers/sources.py +++ b/api/routers/sources.py @@ -185,7 +185,7 @@ async def get_sources( query = f""" SELECT id, asset, created, title, updated, topics, command, (SELECT VALUE count() FROM source_insight WHERE source = $parent.id GROUP ALL)[0].count OR 0 AS insights_count, - ((SELECT VALUE id FROM source_embedding WHERE source = $parent.id LIMIT 1)) != NONE AS embedded + (SELECT VALUE id FROM source_embedding WHERE source = $parent.id LIMIT 1) != [] AS embedded FROM (select value in from reference where out=$notebook_id) {order_clause} LIMIT $limit START $offset @@ -204,7 +204,7 @@ async def get_sources( query = f""" SELECT id, asset, created, title, updated, topics, command, (SELECT VALUE count() FROM source_insight WHERE source = $parent.id GROUP ALL)[0].count OR 0 AS insights_count, - ((SELECT VALUE id FROM source_embedding WHERE source = $parent.id LIMIT 1)) != NONE AS embedded + (SELECT VALUE id FROM source_embedding WHERE source = $parent.id LIMIT 1) != [] AS embedded FROM source {order_clause} LIMIT $limit START $offset