refactor(backend): Remove un-needed join in fix_llm_provider_credentials query (#8728)

This commit is contained in:
Zamil Majdy
2024-11-21 16:35:17 +07:00
committed by GitHub
parent 63e3244e7e
commit c14ab0c37a

View File

@@ -547,16 +547,14 @@ async def fix_llm_provider_credentials():
broken_nodes = await prisma.get_client().query_raw(
"""
SELECT "User".id user_id,
SELECT graph."userId" user_id,
node.id node_id,
node."constantInput" node_preset_input
FROM platform."AgentNode" node
LEFT JOIN platform."AgentGraph" graph
ON node."agentGraphId" = graph.id
LEFT JOIN platform."User" "User"
ON graph."userId" = "User".id
WHERE node."constantInput"::jsonb->'credentials'->>'provider' = 'llm'
ORDER BY user_id;
ORDER BY graph."userId";
"""
)
logger.info(f"Fixing LLM credential inputs on {len(broken_nodes)} nodes")