Skip to content

Commit 61da168

Browse files
committed
Add RevChatGPTChatbogConfigModel
1 parent c6c2647 commit 61da168

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

aishell/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from .language_model import LanguageModel as LanguageModel
22
from .open_ai_response_model import OpenAIResponseModel as OpenAIResponseModel
3+
from .revchatgpt_chatbot_config_model import RevChatGPTChatbotConfigModel as RevChatGPTChatbotConfigModel
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from typing import Optional
2+
3+
from pydantic import BaseModel, root_validator
4+
5+
6+
class RevChatGPTChatbotConfigModel(BaseModel):
7+
email: Optional[str] = None
8+
password: Optional[str] = None
9+
session_token: Optional[str] = None
10+
access_token: Optional[str] = None
11+
paid: bool = False
12+
13+
@root_validator
14+
def check_at_least_one_account_info(cls, values: dict[str, Optional[str]]):
15+
IS_ACCOUNT_LOGIN = values.get('email') and values.get('password')
16+
IS_TOKEN_AUTH = values.get('session_token') or values.get('access_token')
17+
if not IS_ACCOUNT_LOGIN and not IS_TOKEN_AUTH:
18+
raise ValueError('No information for authentication provided.')
19+
20+
return values
21+
22+
class Config:
23+
frozen = True

0 commit comments

Comments
 (0)