fix: 未向模型提交最大回合数

This commit is contained in:
Rock Chin
2022-12-12 17:21:02 +08:00
parent 9a7e7d3862
commit ce104d15ee
+3 -2
View File
@@ -100,12 +100,13 @@ class Session:
def append(self, text: str) -> str: def append(self, text: str) -> str:
self.last_interact_timestamp = int(time.time()) self.last_interact_timestamp = int(time.time())
max_length = config.prompt_submit_length if config.prompt_submit_length is not None else 1024 max_rounds = config.prompt_submit_round_amount if hasattr(config, 'prompt_submit_round_amount') else 7
max_length = config.prompt_submit_length if hasattr(config, "prompt_submit_length") else 1024
# 向API请求补全 # 向API请求补全
response = pkg.openai.manager.get_inst().request_completion(self.cut_out(self.prompt + self.user_name + ':' + response = pkg.openai.manager.get_inst().request_completion(self.cut_out(self.prompt + self.user_name + ':' +
text + '\n' + self.bot_name + ':', text + '\n' + self.bot_name + ':',
7, max_length), self.user_name + ':') max_rounds, max_length), self.user_name + ':')
self.prompt += self.user_name + ':' + text + '\n' + self.bot_name + ':' self.prompt += self.user_name + ':' + text + '\n' + self.bot_name + ':'
# print(response) # print(response)