fix: 应用,不选择模型,开启问题优化和多轮对话就会出现错误 #326 (#330)

This commit is contained in:
shaohuzhang1 2024-04-30 14:28:53 +08:00 committed by GitHub
parent 4eb46786a6
commit b40790492c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -23,6 +23,8 @@ class BaseResetProblemStep(IResetProblemStep):
def execute(self, problem_text: str, history_chat_record: List[ChatRecord] = None, chat_model: BaseChatModel = None,
**kwargs) -> str:
if chat_model is None:
self.context['message_tokens'] = 0
self.context['answer_tokens'] = 0
return problem_text
start_index = len(history_chat_record) - 3
history_message = [[history_chat_record[index].get_human_message(), history_chat_record[index].get_ai_message()]

View File

@ -512,9 +512,7 @@ class ApplicationSerializer(serializers.Serializer):
for update_key in update_keys:
if update_key in instance and instance.get(update_key) is not None:
if update_key == 'multiple_rounds_dialogue':
application.__setattr__('dialogue_number',
0 if not instance.get(update_key) else ModelProvideConstants[
model.provider].value.get_dialogue_number())
application.__setattr__('dialogue_number', 0 if not instance.get(update_key) else 3)
else:
application.__setattr__(update_key, instance.get(update_key))
application.save()