mirror of
https://github.com/yzh503/obsidian-aicommander-plugin.git
synced 2026-07-22 07:40:26 +00:00
Add prompt check for image generator
This commit is contained in:
parent
47fb63f0f4
commit
8fda69740f
1 changed files with 1 additions and 2 deletions
3
main.ts
3
main.ts
|
|
@ -50,9 +50,7 @@ export default class AICommanderPlugin extends Plugin {
|
|||
}
|
||||
|
||||
async generateText(prompt: string, contextPrompt?: string) {
|
||||
|
||||
if (prompt.length < 1 ) throw new Error('Cannot find prompt.');
|
||||
|
||||
if (this.settings.apiKey.length <= 1) throw new Error('OpenAI API Key is not provided.');
|
||||
|
||||
const configuration = new Configuration({ apiKey: this.settings.apiKey });
|
||||
|
|
@ -124,6 +122,7 @@ export default class AICommanderPlugin extends Plugin {
|
|||
}
|
||||
|
||||
async generateImage(prompt: string) {
|
||||
if (prompt.length < 1 ) throw new Error('Cannot find prompt.');
|
||||
if (this.settings.apiKey.length <= 1) throw new Error('OpenAI API Key is not provided.');
|
||||
|
||||
const configuration = new Configuration({
|
||||
|
|
|
|||
Loading…
Reference in a new issue