From b40790492c5f3c9604d306c5293bf00a03439843 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:28:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=94=E7=94=A8=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=A8=A1=E5=9E=8B=EF=BC=8C=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=E5=92=8C=E5=A4=9A=E8=BD=AE?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E5=B0=B1=E4=BC=9A=E5=87=BA=E7=8E=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20#326=20(#330)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/reset_problem_step/impl/base_reset_problem_step.py | 2 ++ apps/application/serializers/application_serializers.py | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py b/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py index 2ab675570..c0595d590 100644 --- a/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py +++ b/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py @@ -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()] diff --git a/apps/application/serializers/application_serializers.py b/apps/application/serializers/application_serializers.py index 164e0083f..e0abb772d 100644 --- a/apps/application/serializers/application_serializers.py +++ b/apps/application/serializers/application_serializers.py @@ -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()