diff --git a/package-lock.json b/package-lock.json index 71c05575..c0852de0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@radix-ui/react-tooltip": "^1.1.6", "@tabler/icons-react": "^2.14.0", "axios": "^1.3.4", + "buffer": "^6.0.3", "chrono-node": "^2.7.7", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", @@ -9473,6 +9474,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" diff --git a/package.json b/package.json index 8174d7db..6d17b76e 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "@radix-ui/react-tooltip": "^1.1.6", "@tabler/icons-react": "^2.14.0", "axios": "^1.3.4", + "buffer": "^6.0.3", "chrono-node": "^2.7.7", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/src/LLMProviders/brevilabsClient.ts b/src/LLMProviders/brevilabsClient.ts index 56dc444b..80cafa79 100644 --- a/src/LLMProviders/brevilabsClient.ts +++ b/src/LLMProviders/brevilabsClient.ts @@ -5,6 +5,7 @@ import { turnOffPlus, turnOnPlus } from "@/plusUtils"; import { getSettings } from "@/settings/model"; import { extractErrorDetail } from "@/utils"; import { Notice } from "obsidian"; +import { Buffer } from "buffer"; export interface BrocaResponse { response: { diff --git a/src/components/Chat.tsx b/src/components/Chat.tsx index 9a0765ee..1ed9640b 100644 --- a/src/components/Chat.tsx +++ b/src/components/Chat.tsx @@ -18,6 +18,7 @@ import { FileParserManager } from "@/tools/FileParserManager"; import { err2String, formatDateTime } from "@/utils"; import { Notice, TFile } from "obsidian"; import React, { useCallback, useContext, useEffect, useRef, useState } from "react"; +import { Buffer } from "buffer"; interface ChatProps { sharedState: SharedState; diff --git a/src/encryptionService.test.ts b/src/encryptionService.test.ts index ecd25ffc..d9e42257 100644 --- a/src/encryptionService.test.ts +++ b/src/encryptionService.test.ts @@ -22,6 +22,7 @@ global.TextDecoder = TextDecoder as any; import { encryptAllKeys, getDecryptedKey, getEncryptedKey } from "@/encryptionService"; import { type CopilotSettings } from "@/settings/model"; import { Platform } from "obsidian"; +import { Buffer } from "buffer"; // Mock window.btoa and window.atob for base64 encoding/decoding global.btoa = jest.fn().mockImplementation((str) => Buffer.from(str).toString("base64")); diff --git a/src/encryptionService.ts b/src/encryptionService.ts index c28ddeda..951961c4 100644 --- a/src/encryptionService.ts +++ b/src/encryptionService.ts @@ -1,5 +1,6 @@ import { type CopilotSettings } from "@/settings/model"; import { Platform } from "obsidian"; +import { Buffer } from "buffer"; // @ts-ignore let safeStorageInternal: Electron.SafeStorage | null = null; diff --git a/src/utils.ts b/src/utils.ts index 69e093fc..d931690d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,6 +20,7 @@ import { BaseChain, RetrievalQAChain } from "langchain/chains"; import moment from "moment"; import { MarkdownView, Notice, TFile, Vault, requestUrl } from "obsidian"; import { CustomModel } from "./aiParams"; +import { Buffer } from "buffer"; // Add custom error type at the top of the file interface APIError extends Error {