Skip to content

Commit b407904

Browse files
authored
fix: 应用,不选择模型,开启问题优化和多轮对话就会出现错误 #326 (#330)
1 parent 4eb4678 commit b407904

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class BaseResetProblemStep(IResetProblemStep):
2323
def execute(self, problem_text: str, history_chat_record: List[ChatRecord] = None, chat_model: BaseChatModel = None,
2424
**kwargs) -> str:
2525
if chat_model is None:
26+
self.context['message_tokens'] = 0
27+
self.context['answer_tokens'] = 0
2628
return problem_text
2729
start_index = len(history_chat_record) - 3
2830
history_message = [[history_chat_record[index].get_human_message(), history_chat_record[index].get_ai_message()]

apps/application/serializers/application_serializers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,7 @@ def edit(self, instance: Dict, with_valid=True):
512512
for update_key in update_keys:
513513
if update_key in instance and instance.get(update_key) is not None:
514514
if update_key == 'multiple_rounds_dialogue':
515-
application.__setattr__('dialogue_number',
516-
0 if not instance.get(update_key) else ModelProvideConstants[
517-
model.provider].value.get_dialogue_number())
515+
application.__setattr__('dialogue_number', 0 if not instance.get(update_key) else 3)
518516
else:
519517
application.__setattr__(update_key, instance.get(update_key))
520518
application.save()

0 commit comments

Comments
 (0)