Skip to content

Commit

Permalink
fix(plugin): api key would not reload on change for the chat
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminshafii committed Jan 1, 2025
1 parent cbc2f9b commit a4ae8df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ export default class FileOrganizer extends Plugin {
return "";
}
}
getApiKey(): string {
return this.settings.API_KEY;
}

async formatStream(
content: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/views/assistant/ai-chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const ChatComponent: React.FC<ChatComponentProps> = ({
experimental_throttle: 100,
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
Authorization: `Bearer ${plugin.getApiKey()}`,
},
fetch: async (url, options) => {
logMessage(plugin.settings.showLocalLLMInChat, "showLocalLLMInChat");
Expand Down

0 comments on commit a4ae8df

Please sign in to comment.