Skip to content

Commit 1c3ea93

Browse files
authored
fix: 修复【应用编排】客户端提问达到限制时,隐藏知识来源 (#696)
1 parent bcb2773 commit 1c3ea93

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

ui/src/api/type/application.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface chatType {
2929
is_stop?: boolean
3030
record_id: string
3131
vote_status: string
32+
status?: number
3233
}
3334

3435
export class ChatRecordManage {
@@ -105,6 +106,12 @@ export class ChatManagement {
105106
chatRecord.append(content)
106107
}
107108
}
109+
static updateStatus(chatRecordId: string, code: number) {
110+
const chatRecord = this.chatMessageContainer[chatRecordId]
111+
if (chatRecord) {
112+
chatRecord.chat.status = code
113+
}
114+
}
108115
/**
109116
* 持续从缓存区 写出数据
110117
* @param chatRecordId 对话记录id

ui/src/components/ai-chat/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
>
105105
</div>
106106
</div>
107-
<div v-if="item.write_ed && props.appId" class="flex-between">
107+
<div v-if="item.write_ed && props.appId && 500 != item.status" class="flex-between">
108108
<OperationButton
109109
:data="item"
110110
:applicationId="appId"
@@ -280,7 +280,7 @@ watch(
280280
function showSource(row: any) {
281281
if (props.log) {
282282
return true
283-
} else if (row.write_ed) {
283+
} else if (row.write_ed && 500 !== row.status) {
284284
if (id || props.data?.show_source) {
285285
return true
286286
}
@@ -453,6 +453,7 @@ const errorWrite = (chat: any, message?: string) => {
453453
ChatManagement.addChatRecord(chat, 50, loading)
454454
ChatManagement.write(chat.id)
455455
ChatManagement.append(chat.id, message || '抱歉,当前正在维护,无法提供服务,请稍后再试!')
456+
ChatManagement.updateStatus(chat.id, 500)
456457
ChatManagement.close(chat.id)
457458
}
458459
function chatMessage(chat?: any, problem?: string, re_chat?: boolean) {
@@ -466,7 +467,8 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean) {
466467
write_ed: false,
467468
is_stop: false,
468469
record_id: '',
469-
vote_status: '-1'
470+
vote_status: '-1',
471+
status: undefined
470472
})
471473
chatList.value.push(chat)
472474
ChatManagement.addChatRecord(chat, 50, loading)

0 commit comments

Comments
 (0)