Skip to content

Commit e457538

Browse files
committed
fix: Resource application chat record get
1 parent bd589e5 commit e457538

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

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

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import { useRoute } from 'vue-router'
5656
import applicationApi from '@/api/application/application'
5757
import chatAPI from '@/api/chat/chat'
5858
import SystemResourceManagementApplicationAPI from "@/api/system-resource-management/application.ts"
59+
import syetrmResourceManagementChatLogApi from '@/api/system-resource-management/chat-log'
5960
import chatLogApi from '@/api/application/chat-log'
6061
import { ChatManagement, type chatType } from '@/api/type/application'
6162
import { randomId } from '@/utils/common'
@@ -295,35 +296,36 @@ const getOpenChatAPI = () => {
295296
}
296297
}
297298
298-
/**
299-
* 获取对话详情
300-
* @param row
301-
*/
302-
function getSourceDetail(row: any) {
299+
const getChatRecordDetailsAPI = (row: any) => {
303300
if (row.record_id) {
304301
if (props.type === 'debug-ai-chat') {
305-
chatLogApi
306-
.getChatRecordDetails(id || props.appId, row.chat_id, row.record_id, loading)
307-
.then((res) => {
308-
const exclude_keys = ['answer_text', 'id', 'answer_text_list']
309-
Object.keys(res.data).forEach((key) => {
310-
if (!exclude_keys.includes(key)) {
311-
row[key] = res.data[key]
312-
}
313-
})
314-
})
302+
if (route.path.includes('resource-management')) {
303+
return syetrmResourceManagementChatLogApi
304+
.getChatRecordDetails(id || props.appId, row.chat_id, row.record_id, loading)
305+
} else {
306+
return chatLogApi
307+
.getChatRecordDetails(id || props.appId, row.chat_id, row.record_id, loading)
308+
}
315309
} else {
316-
chatAPI.getChatRecord(row.chat_id, row.record_id, loading).then((res) => {
317-
const exclude_keys = ['answer_text', 'id', 'answer_text_list']
318-
Object.keys(res.data).forEach((key) => {
319-
if (!exclude_keys.includes(key)) {
320-
row[key] = res.data[key]
321-
}
322-
})
323-
})
310+
return chatAPI.getChatRecord(row.chat_id, row.record_id, loading)
324311
}
325312
}
326-
return true
313+
return Promise.reject("404")
314+
}
315+
/**
316+
* 获取对话详情
317+
* @param row
318+
*/
319+
function getSourceDetail(row: any) {
320+
return getChatRecordDetailsAPI(row).then((res) => {
321+
const exclude_keys = ['answer_text', 'id', 'answer_text_list']
322+
Object.keys(res.data).forEach((key) => {
323+
if (!exclude_keys.includes(key)) {
324+
row[key] = res.data[key]
325+
}
326+
})
327+
})
328+
327329
}
328330
/**
329331
* 对话

0 commit comments

Comments
 (0)