Spaces:
Paused
Paused
Commit
·
0988295
1
Parent(s):
21111d9
Update bot/chatgpt/chat_gpt_bot.py
Browse files
bot/chatgpt/chat_gpt_bot.py
CHANGED
@@ -11,8 +11,8 @@ user_session = dict()
|
|
11 |
# OpenAI对话模型API (可用)
|
12 |
class ChatGPTBot(Bot):
|
13 |
def __init__(self):
|
14 |
-
openai.
|
15 |
-
openai.
|
16 |
|
17 |
def reply(self, query, context=None):
|
18 |
# acquire reply content
|
@@ -42,13 +42,8 @@ class ChatGPTBot(Bot):
|
|
42 |
def reply_text(self, query, user_id, retry_count=0):
|
43 |
try:
|
44 |
response = openai.ChatCompletion.create(
|
45 |
-
model="
|
46 |
-
messages=query
|
47 |
-
temperature=1, # 值在[0,1]之间,越大表示回复越具有不确定性
|
48 |
-
max_tokens=600, # 回复最大的字符数
|
49 |
-
top_p=1,
|
50 |
-
frequency_penalty=0, # [-2,2]之间,该值越大则更倾向于产生不同的内容
|
51 |
-
presence_penalty=0, # [-2,2]之间,该值越大则更倾向于产生不同的内容
|
52 |
)
|
53 |
# res_content = response.choices[0]['text'].strip().replace('<|endoftext|>', '')
|
54 |
logger.info(response.choices[0]['message']['content'])
|
|
|
11 |
# OpenAI对话模型API (可用)
|
12 |
class ChatGPTBot(Bot):
|
13 |
def __init__(self):
|
14 |
+
openai.api_base = "http://i-1.gpushare.com:16398/v1"
|
15 |
+
openai.api_key = "none"
|
16 |
|
17 |
def reply(self, query, context=None):
|
18 |
# acquire reply content
|
|
|
42 |
def reply_text(self, query, user_id, retry_count=0):
|
43 |
try:
|
44 |
response = openai.ChatCompletion.create(
|
45 |
+
model="chatglm2-6b", # 对话模型的名称
|
46 |
+
messages=query
|
|
|
|
|
|
|
|
|
|
|
47 |
)
|
48 |
# res_content = response.choices[0]['text'].strip().replace('<|endoftext|>', '')
|
49 |
logger.info(response.choices[0]['message']['content'])
|