From f1b04e8a1b667a312dce6e4223b3895fdd20e808 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 25 Mar 2024 10:45:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=94=E7=94=A8=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=97=B6=E5=A6=82=E4=BD=95=E6=A8=A1=E5=9E=8B=E6=9C=AA=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E8=BE=93=E5=87=BA=E4=BC=98=E5=8C=96=E9=97=AE=E9=A2=98?= =?UTF-8?q?,=E5=88=99=E4=BD=BF=E7=94=A8=E5=8E=9F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E9=97=AE=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #13 --- .../step/reset_problem_step/impl/base_reset_problem_step.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 14a68d49a..fffdf4662 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 @@ -28,8 +28,10 @@ class BaseResetProblemStep(IResetProblemStep): range(start_index if start_index > 0 else 0, len(history_chat_record))] message_list = [*flat_map(history_message), HumanMessage(content=prompt.format(**{'question': problem_text}))] - response = chat_model(message_list) - padding_problem = response.content[response.content.index('') + 6:response.content.index('')] + response = chat_model.invoke(message_list) + padding_problem = problem_text + if response.content.__contains__("") and response.content.__contains__(''): + padding_problem = response.content[response.content.index('') + 6:response.content.index('')] self.context['message_tokens'] = chat_model.get_num_tokens_from_messages(message_list) self.context['answer_tokens'] = chat_model.get_num_tokens(padding_problem) return padding_problem