Skip to content

Commit 8386e8e

Browse files
committed
fix: 修复简易应用对话无法显示内容
1 parent 46c3725 commit 8386e8e

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ def event_content(response,
6565
try:
6666
for chunk in response:
6767
all_text += chunk.content
68-
yield manage.get_base_to_response().to_stream_chunk_response(chat_id, str(chat_record_id), chunk.content,
68+
yield manage.get_base_to_response().to_stream_chunk_response(chat_id, str(chat_record_id), 'ai-chat-node',
69+
[], chunk.content,
6970
False,
70-
0, 0)
71+
0, 0, {'node_is_end': False,
72+
'view_type': 'many_view',
73+
'node_type': 'ai-chat-node'})
7174
# 获取token
7275
if is_ai_chat:
7376
try:
@@ -82,8 +85,11 @@ def event_content(response,
8285
write_context(step, manage, request_token, response_token, all_text)
8386
post_response_handler.handler(chat_id, chat_record_id, paragraph_list, problem_text,
8487
all_text, manage, step, padding_problem_text, client_id)
85-
yield manage.get_base_to_response().to_stream_chunk_response(chat_id, str(chat_record_id), '', True,
86-
request_token, response_token)
88+
yield manage.get_base_to_response().to_stream_chunk_response(chat_id, str(chat_record_id), 'ai-chat-node',
89+
[], '', True,
90+
request_token, response_token,
91+
{'node_is_end': True, 'view_type': 'many_view',
92+
'node_type': 'ai-chat-node'})
8793
add_access_num(client_id, client_type)
8894
except Exception as e:
8995
logging.getLogger("max_kb_error").error(f'{str(e)}:{traceback.format_exc()}')
@@ -92,7 +98,11 @@ def event_content(response,
9298
post_response_handler.handler(chat_id, chat_record_id, paragraph_list, problem_text,
9399
all_text, manage, step, padding_problem_text, client_id)
94100
add_access_num(client_id, client_type)
95-
yield manage.get_base_to_response().to_stream_chunk_response(chat_id, str(chat_record_id), all_text, True, 0, 0)
101+
yield manage.get_base_to_response().to_stream_chunk_response(chat_id, str(chat_record_id), all_text,
102+
'ai-chat-node',
103+
[], True, 0, 0,
104+
{'node_is_end': True, 'view_type': 'many_view',
105+
'node_type': 'ai-chat-node'})
96106

97107

98108
class BaseChatStep(IChatStep):

ui/src/api/type/application.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ export class ChatRecordManage {
257257
}
258258
}
259259
append(answer_text_block: string) {
260-
for (let index = 0; index < answer_text_block.length; index++) {
261-
this.chat.buffer.push(answer_text_block[index])
262-
}
260+
const index =this.chat.answer_text_list.indexOf("")
261+
this.chat.answer_text_list[index]=answer_text_block
262+
263263
}
264264
}
265265

0 commit comments

Comments
 (0)