mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: Non streaming response answers_list (#2461)
This commit is contained in:
parent
7497c1b7cd
commit
dc79a22ba3
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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'):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue