From a3dd488995e6a2d459d927169334ecc72116fd0a Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 3 Mar 2025 14:44:38 +0800 Subject: [PATCH 1/4] feat: Non streaming response answers_list --- apps/application/flow/workflow_manage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/application/flow/workflow_manage.py b/apps/application/flow/workflow_manage.py index d6bb43bf6c3..cb3f61e2251 100644 --- a/apps/application/flow/workflow_manage.py +++ b/apps/application/flow/workflow_manage.py @@ -337,13 +337,15 @@ def run_block(self, language='zh'): answer_text = '\n\n'.join( '\n\n'.join([a.get('content') for a in answer]) for answer in answer_text_list) + answer_list = reduce(lambda pre, _n: [*pre, *_n], answer_text_list, []) self.work_flow_post_handler.handler(self.params['chat_id'], self.params['chat_record_id'], answer_text, self) return self.base_to_response.to_block_response(self.params['chat_id'], self.params['chat_record_id'], answer_text, True , message_tokens, answer_tokens, - _status=status.HTTP_200_OK if self.status == 200 else status.HTTP_500_INTERNAL_SERVER_ERROR) + _status=status.HTTP_200_OK if self.status == 200 else status.HTTP_500_INTERNAL_SERVER_ERROR, + other_params={'answer_list': answer_list}) def run_stream(self, current_node, node_result_future, language='zh'): """ From 92e366ad3685988b64675b0ae823ae2463b298e2 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 3 Mar 2025 14:48:26 +0800 Subject: [PATCH 2/4] feat: Non streaming response answers_list --- .../chat_pipeline/step/chat_step/impl/base_chat_step.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py b/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py index 7fa4f249ac9..71d135275ff 100644 --- a/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py +++ b/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py @@ -307,7 +307,11 @@ def execute_block(self, message_list: List[BaseMessage], return manage.get_base_to_response().to_block_response(str(chat_id), str(chat_record_id), content, True, request_token, response_token, - {'reasoning_content': reasoning_content}) + {'reasoning_content': reasoning_content, + 'answer_list': { + 'content': content, + 'reasoning_content': reasoning_content + }}) except Exception as e: all_text = 'Exception:' + str(e) write_context(self, manage, 0, 0, all_text) From b4461516e983ca28fde22632aaa7feb539a6eb70 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 3 Mar 2025 14:52:36 +0800 Subject: [PATCH 3/4] feat: Non streaming response answers_list --- apps/common/util/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/util/test.py b/apps/common/util/test.py index 00a267c6a40..bfcab42d4f1 100644 --- a/apps/common/util/test.py +++ b/apps/common/util/test.py @@ -13,7 +13,7 @@ from django.core.cache import cache # alg使用的算法 -HEADER = {'typ': 'JWP', 'alg': 'default'} +HEADER = {'type': 'JWP', 'alg': 'default'} TOKEN_KEY = 'solomon_world_token' TOKEN_SALT = 'solomonwanc@gmail.com' TIME_OUT = 30 * 60 From b746a56cf6b7234163ee3abadc3eb8f6c9f1c062 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 3 Mar 2025 14:53:41 +0800 Subject: [PATCH 4/4] feat: Non streaming response answers_list --- .../chat_pipeline/step/chat_step/impl/base_chat_step.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py b/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py index 71d135275ff..7395240b151 100644 --- a/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py +++ b/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py @@ -308,10 +308,10 @@ def execute_block(self, message_list: List[BaseMessage], content, True, request_token, response_token, {'reasoning_content': reasoning_content, - 'answer_list': { + 'answer_list': [{ 'content': content, 'reasoning_content': reasoning_content - }}) + }]}) except Exception as e: all_text = 'Exception:' + str(e) write_context(self, manage, 0, 0, all_text)