mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend): add schema prefix to ContentType enum casts in SQL queries
- Fix INSERT, SELECT, and DELETE queries to use {schema_prefix}"ContentType"
- Ensures queries work correctly in platform schema (Supabase)
- Fixes 'type ContentType does not exist' error in production
Resolves errors in get_content_embedding, store_content_embedding, and delete_content_embedding functions.
This commit is contained in:
@@ -141,7 +141,7 @@ async def store_content_embedding(
|
||||
INSERT INTO {schema_prefix}"UnifiedContentEmbedding" (
|
||||
"id", "contentType", "contentId", "userId", "embedding", "searchableText", "metadata", "createdAt", "updatedAt"
|
||||
)
|
||||
VALUES (gen_random_uuid()::text, $1::"ContentType", $2, $3, $4::vector, $5, $6::jsonb, NOW(), NOW())
|
||||
VALUES (gen_random_uuid()::text, $1::{schema_prefix}"ContentType", $2, $3, $4::vector, $5, $6::jsonb, NOW(), NOW())
|
||||
ON CONFLICT ("contentType", "contentId", "userId")
|
||||
DO UPDATE SET
|
||||
"embedding" = $4::vector,
|
||||
@@ -209,7 +209,7 @@ async def get_content_embedding(
|
||||
"createdAt",
|
||||
"updatedAt"
|
||||
FROM {schema_prefix}"UnifiedContentEmbedding"
|
||||
WHERE "contentType" = $1::"ContentType" AND "contentId" = $2 AND ("userId" = $3 OR ($3 IS NULL AND "userId" IS NULL))
|
||||
WHERE "contentType" = $1::{schema_prefix}"ContentType" AND "contentId" = $2 AND ("userId" = $3 OR ($3 IS NULL AND "userId" IS NULL))
|
||||
""",
|
||||
content_type,
|
||||
content_id,
|
||||
@@ -317,7 +317,7 @@ async def delete_content_embedding(content_type: ContentType, content_id: str) -
|
||||
await execute_raw_with_schema(
|
||||
"""
|
||||
DELETE FROM {schema_prefix}"UnifiedContentEmbedding"
|
||||
WHERE "contentType" = $1::"ContentType" AND "contentId" = $2
|
||||
WHERE "contentType" = $1::{schema_prefix}"ContentType" AND "contentId" = $2
|
||||
""",
|
||||
content_type,
|
||||
content_id,
|
||||
|
||||
Reference in New Issue
Block a user