-
Notifications
You must be signed in to change notification settings - Fork 44.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(backend): Add migrations to fix credentials inputs with invalid p…
…rovider "llm" (#8674) In #8524, the "llm" credentials provider was replaced. There are still entries with `"provider": "llm"` in the system though, and those break if not migrated. - SQL migration to fix the obvious ones where we know the provider from `credentials.id` - Non-SQL migration to fix the rest
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...gpt_platform/backend/migrations/20241115170707_fix_llm_provider_credentials/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Correct credentials.provider field on all nodes with 'llm' provider credentials | ||
UPDATE "AgentNode" | ||
SET "constantInput" = JSONB_SET( | ||
"constantInput"::jsonb, | ||
'{credentials,provider}', | ||
CASE | ||
WHEN "constantInput"::jsonb->'credentials'->>'id' = '53c25cb8-e3ee-465c-a4d1-e75a4c899c2a' THEN '"openai"'::jsonb | ||
WHEN "constantInput"::jsonb->'credentials'->>'id' = '24e5d942-d9e3-4798-8151-90143ee55629' THEN '"anthropic"'::jsonb | ||
WHEN "constantInput"::jsonb->'credentials'->>'id' = '4ec22295-8f97-4dd1-b42b-2c6957a02545' THEN '"groq"'::jsonb | ||
ELSE "constantInput"::jsonb->'credentials'->'provider' | ||
END | ||
)::text | ||
WHERE "constantInput"::jsonb->'credentials'->>'provider' = 'llm'; |