Skip to content

Commit dc79a22

Browse files
authored
feat: Non streaming response answers_list (#2461)
1 parent 7497c1b commit dc79a22

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ def execute_block(self, message_list: List[BaseMessage],
307307
return manage.get_base_to_response().to_block_response(str(chat_id), str(chat_record_id),
308308
content, True,
309309
request_token, response_token,
310-
{'reasoning_content': reasoning_content})
310+
{'reasoning_content': reasoning_content,
311+
'answer_list': [{
312+
'content': content,
313+
'reasoning_content': reasoning_content
314+
}]})
311315
except Exception as e:
312316
all_text = 'Exception:' + str(e)
313317
write_context(self, manage, 0, 0, all_text)

apps/application/flow/workflow_manage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,15 @@ def run_block(self, language='zh'):
337337
answer_text = '\n\n'.join(
338338
'\n\n'.join([a.get('content') for a in answer]) for answer in
339339
answer_text_list)
340+
answer_list = reduce(lambda pre, _n: [*pre, *_n], answer_text_list, [])
340341
self.work_flow_post_handler.handler(self.params['chat_id'], self.params['chat_record_id'],
341342
answer_text,
342343
self)
343344
return self.base_to_response.to_block_response(self.params['chat_id'],
344345
self.params['chat_record_id'], answer_text, True
345346
, message_tokens, answer_tokens,
346-
_status=status.HTTP_200_OK if self.status == 200 else status.HTTP_500_INTERNAL_SERVER_ERROR)
347+
_status=status.HTTP_200_OK if self.status == 200 else status.HTTP_500_INTERNAL_SERVER_ERROR,
348+
other_params={'answer_list': answer_list})
347349

348350
def run_stream(self, current_node, node_result_future, language='zh'):
349351
"""

apps/common/util/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from django.core.cache import cache
1414

1515
# alg使用的算法
16-
HEADER = {'typ': 'JWP', 'alg': 'default'}
16+
HEADER = {'type': 'JWP', 'alg': 'default'}
1717
TOKEN_KEY = 'solomon_world_token'
1818
TOKEN_SALT = '[email protected]'
1919
TIME_OUT = 30 * 60

0 commit comments

Comments
 (0)