mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 19:57:04 +08:00
doc: 添加注释;完善格式
This commit is contained in:
parent
fd25d61b56
commit
623f094e5b
|
@ -17,6 +17,7 @@ IMAGE_MODELS = {
|
|||
|
||||
}
|
||||
|
||||
|
||||
class Model():
|
||||
|
||||
can_chat = False
|
||||
|
@ -45,8 +46,10 @@ class Model():
|
|||
|
||||
def get_response(self):
|
||||
return self.ret
|
||||
|
||||
|
||||
class ChatCompletionModel(Model):
|
||||
"""ChatCompletion接口实现"""
|
||||
def __init__(self, model_name, user_name):
|
||||
request_fun = openai.ChatCompletion.create
|
||||
self.can_chat = True
|
||||
|
@ -59,8 +62,10 @@ class ChatCompletionModel(Model):
|
|||
|
||||
def get_content(self):
|
||||
return self.message
|
||||
|
||||
|
||||
class CompletionModel(Model):
|
||||
"""Completion接口实现"""
|
||||
def __init__(self, model_name, user_name):
|
||||
request_fun = openai.Completion.create
|
||||
super().__init__(model_name, user_name, request_fun)
|
||||
|
@ -82,6 +87,7 @@ class CompletionModel(Model):
|
|||
|
||||
def get_text(self):
|
||||
return self.message
|
||||
|
||||
|
||||
def OpenaiModel(model_name:str, user_name='user'):
|
||||
if model_name in CHAT_COMPLETION_MODELS:
|
||||
|
|
Loading…
Reference in New Issue
Block a user