Refactor messageHandler to check OpenAI API key
- Import checkOpenaiApiKey function from contributes/commands. - Update sendMessage condition to include checkOpenaiApiKey.
This commit is contained in:
parent
50b8ae8185
commit
15230c80a3
@ -7,6 +7,7 @@ import '../context/loadContexts';
|
||||
import { logger } from '../util/logger';
|
||||
import { on } from 'events';
|
||||
import { isWaitForApiKey, onApiKey } from './historyMessages';
|
||||
import { checkOpenaiApiKey } from '../contributes/commands';
|
||||
|
||||
|
||||
export class MessageHandler {
|
||||
@ -33,7 +34,7 @@ export class MessageHandler {
|
||||
}
|
||||
}
|
||||
if (message.command === 'sendMessage') {
|
||||
if (await isWaitForApiKey()) {
|
||||
if (await isWaitForApiKey() && !await checkOpenaiApiKey()) {
|
||||
onApiKey(message.text, panel);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user