Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyan172004 committed Dec 11, 2024
1 parent b02ca86 commit 9f5188c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ interface ChromeResponseMessage {
chrome.runtime.onMessage.addListener(
(message: ChromeResponseMessage, _sender, sendResponse) => {
if (message.type === 'RESET_SETTINGS') {
LLMEngine.resetAll();
void (async () => {
try {
await LLMEngine.resetAll();
sendResponse({ success: true });
} catch (error) {
console.error('Error resetting settings:', error);
sendResponse({ success: false, error: String(error) });
}
})();
return true;
}
if (message.type === 'API_CALL') {
Expand Down
3 changes: 2 additions & 1 deletion src/docFillerCore/engines/gptEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class LLMEngine {
console.error('Error fetching API keys:', error);
});
}
public static resetAll(): void {
public static async resetAll(): Promise<void> {
this.instances = {
[LLMEngineType.ChatGPT]: undefined,
[LLMEngineType.Gemini]: undefined,
Expand All @@ -88,6 +88,7 @@ export class LLMEngine {
mistralApiKey: undefined,
anthropicApiKey: undefined,
};
await this.fetchApiKeys();
}

private static async fetchApiKeys(): Promise<void> {
Expand Down

0 comments on commit 9f5188c

Please sign in to comment.