mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
Encrypt embedding model api keys (#1405)
This commit is contained in:
parent
c25455f08e
commit
7d451f787b
1 changed files with 10 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { type CopilotSettings } from "@/settings/model";
|
||||
import { Platform } from "obsidian";
|
||||
import { Buffer } from "buffer";
|
||||
import { Platform } from "obsidian";
|
||||
|
||||
// @ts-ignore
|
||||
let safeStorageInternal: Electron.SafeStorage | null = null;
|
||||
|
|
@ -58,6 +58,15 @@ export async function encryptAllKeys(
|
|||
);
|
||||
}
|
||||
|
||||
if (Array.isArray(settings.activeEmbeddingModels)) {
|
||||
newSettings.activeEmbeddingModels = await Promise.all(
|
||||
settings.activeEmbeddingModels.map(async (model) => ({
|
||||
...model,
|
||||
apiKey: await getEncryptedKey(model.apiKey || ""),
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue