diff --git a/main.py b/main.py index eee3bbc4..159bcd9e 100644 --- a/main.py +++ b/main.py @@ -368,13 +368,13 @@ async def create_embedding( await db.query_raw( f""" UPDATE {vector_store_table} - SET file_counts = jsonb_set( - COALESCE(file_counts, '{{"in_progress": 0, "completed": 0, "failed": 0, "cancelled": 0, "total": 0}}'::jsonb), - '{{completed}}', - (COALESCE(file_counts->>'completed', '0')::int + 1)::text::jsonb - ), + SET file_counts = jsonb_set( - file_counts, + jsonb_set( + COALESCE(file_counts, '{{"in_progress": 0, "completed": 0, "failed": 0, "cancelled": 0, "total": 0}}'::jsonb), + '{{completed}}', + (COALESCE(file_counts->>'completed', '0')::int + 1)::text::jsonb + ), '{{total}}', (COALESCE(file_counts->>'total', '0')::int + 1)::text::jsonb ), @@ -468,13 +468,13 @@ async def create_embeddings_batch( await db.query_raw( f""" UPDATE {vector_store_table} - SET file_counts = jsonb_set( - COALESCE(file_counts, '{{"in_progress": 0, "completed": 0, "failed": 0, "cancelled": 0, "total": 0}}'::jsonb), - '{{completed}}', - (COALESCE(file_counts->>'completed', '0')::int + $2)::text::jsonb - ), + SET file_counts = jsonb_set( - file_counts, + jsonb_set( + COALESCE(file_counts, '{{"in_progress": 0, "completed": 0, "failed": 0, "cancelled": 0, "total": 0}}'::jsonb), + '{{completed}}', + (COALESCE(file_counts->>'completed', '0')::int + $2)::text::jsonb + ), '{{total}}', (COALESCE(file_counts->>'total', '0')::int + $2)::text::jsonb ),