Skip to content

Commit

Permalink
fix: #337
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 committed Sep 15, 2023
1 parent 0cd7c37 commit 269f559
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions xiaogpt/bot/glm_bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""ChatGLM bot"""
from __future__ import annotations

from typing import Any, AsyncGenerator

import zhipuai
Expand Down
7 changes: 5 additions & 2 deletions xiaogpt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ def __post_init__(self) -> None:
"New bing bot needs bing_cookie_path or bing_cookies, read this: "
"https://github.com/acheong08/EdgeGPT#getting-authentication-required"
)
elif not self.openai_key:
raise Exception("Using GPT api needs openai API key, please google how to")
if (
self.api_base
and self.api_base.endswith(("openai.azure.com", "openai.azure.com/"))
Expand All @@ -104,6 +102,11 @@ def __post_init__(self) -> None:
"Using Azure OpenAI needs deployment_id, read this: "
"https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/chatgpt?pivots=programming-language-chat-completions"
)
if self.bot in ["chatgptapi", "gpt3"]:
if not self.openai_key:
raise Exception(
"Using GPT api needs openai API key, please google how to"
)

@property
def tts_command(self) -> str:
Expand Down

0 comments on commit 269f559

Please sign in to comment.