11<script setup lang="ts">
22import { provide , watch } from ' vue'
33import ChatLogApi from ' @/api/admin/workspace/application/chat-log'
4+ import type { ChatLogRecord } from ' @/api/types'
45import ConversationLayout from ' ../../core/layout/index.vue'
56import LogMessageList from ' ../../components/log-message-list/index.vue'
67import ExecutionDetail from ' ../../right-sidebar/execution-detail/index.vue'
@@ -9,14 +10,26 @@ import { EXECUTION_DETAIL_KEY, createExecutionDetailStore } from '../../right-si
910
1011defineOptions ({ name: ' LogConversation' })
1112
12- const props = defineProps <{ chatId: string ; applicationId? : string }>()
13+ /** 对话日志分页接口入参,与各资源范围 chat-log API 的 getChatRecordLog 保持结构一致。 */
14+ type ChatRecordApi = {
15+ getChatRecordLog: (
16+ applicationId : string ,
17+ chatId : string ,
18+ page : { currentPage: number ; pageSize: number },
19+ orderAsc ? : boolean ,
20+ ) => Promise <{ records: ChatLogRecord [] }>
21+ }
22+
23+ const props = withDefaults (defineProps <{ chatId: string ; applicationId? : string ; chatLogApi? : ChatRecordApi }>(), {
24+ chatLogApi : () => ChatLogApi ,
25+ })
1326
1427// 只读日志:只读消息列表 + 执行详情,无会话列表、无输入框。
1528// 不注入 MESSAGE_LIST_KEY,表单等内容项拿不到发送能力即自动只读。
1629const msgs = createLogMessageListStore ({
1730 // 降序取(最新在前),store 页内 reverse 成正序、上滑加载更旧
1831 pageRecords : (cid , p , s ) =>
19- ChatLogApi .getChatRecordLog (props .applicationId || ' ' , cid , { currentPage: p , pageSize: s }, false ),
32+ props . chatLogApi .getChatRecordLog (props .applicationId || ' ' , cid , { currentPage: p , pageSize: s }, false ),
2033 getChatId : () => props .chatId ,
2134})
2235const detail = createExecutionDetailStore ()
0 commit comments