This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web] Stop persisting api keys inside conversations (#35)
- Loading branch information
1 parent
9451077
commit 37c496e
Showing
5 changed files
with
42 additions
and
11 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
18 changes: 18 additions & 0 deletions
18
packages/web/src/entities/migrations/persistence/1688740831717_remove-api-key.ts
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,18 @@ | ||
export const migratePersistenceRemoveApiKey = ( | ||
value: Record<string, any> | ||
): Record<string, any> => { | ||
if (!value.conversations || !Array.isArray(value.conversations)) | ||
return value; | ||
|
||
value.conversations = value.conversations.map((conversation) => { | ||
if (conversation.config?.apiKey === undefined) return conversation; | ||
const { apiKey, ...config } = conversation.config; | ||
|
||
return { | ||
...conversation, | ||
config, | ||
}; | ||
}); | ||
|
||
return value; | ||
}; |
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