-
{{ $t('chat.userInput') }}
+
{{ inputFieldConfig.title }}
From dc79a22ba33f022b671169f9bdc2d9f411e8740e Mon Sep 17 00:00:00 2001
From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com>
Date: Mon, 3 Mar 2025 14:54:45 +0800
Subject: [PATCH 6/6] feat: Non streaming response answers_list (#2461)
---
.../chat_pipeline/step/chat_step/impl/base_chat_step.py | 6 +++++-
apps/application/flow/workflow_manage.py | 4 +++-
apps/common/util/test.py | 2 +-
3 files changed, 9 insertions(+), 3 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 7fa4f249a..7395240b1 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 @@ class BaseChatStep(IChatStep):
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)
diff --git a/apps/application/flow/workflow_manage.py b/apps/application/flow/workflow_manage.py
index d6bb43bf6..cb3f61e22 100644
--- a/apps/application/flow/workflow_manage.py
+++ b/apps/application/flow/workflow_manage.py
@@ -337,13 +337,15 @@ class WorkflowManage:
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'):
"""
diff --git a/apps/common/util/test.py b/apps/common/util/test.py
index 00a267c6a..bfcab42d4 100644
--- a/apps/common/util/test.py
+++ b/apps/common/util/test.py
@@ -13,7 +13,7 @@ from django.core import signing
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