diff --git a/ui/src/conversation-panel/components/log-message-list/index.ts b/ui/src/conversation-panel/components/log-message-list/index.ts index 7bffc9ceff6..bc06068ad9c 100644 --- a/ui/src/conversation-panel/components/log-message-list/index.ts +++ b/ui/src/conversation-panel/components/log-message-list/index.ts @@ -1,12 +1,14 @@ -import { ref, inject, type InjectionKey } from 'vue' +import { ref, inject, type InjectionKey, type Ref } from 'vue' import type { ChatLogRecord } from '@/api/types' -import type { ChatMessage, ChatRecordMeta } from '../../core/types' +import type { ChatMessage, ChatRecordMeta, ConversationAppInfo } from '../../core/types' // 只读会话记录(如对话日志):只分页拉取历史记录,不发送、不续跑、不流式。 // 与 message-list 刻意不共用 store 约定,也不注入 MESSAGE_LIST_KEY,表单等内容项因此自动只读。 export interface LogMessageListDeps { pageRecords: (chatId: string, page: number, size: number) => Promise<{ records: ChatLogRecord[] }> getChatId: () => string + /** 当前智能体信息:只读,由 view 加载维护。 */ + appInfo: Readonly> } // 从后端 chat_record(reset_chat_record 结构)提取底部信息栏数据 @@ -19,7 +21,7 @@ const buildRecordMeta = (raw: ChatLogRecord): ChatRecordMeta => ({ }) export function createLogMessageListStore(deps: LogMessageListDeps) { - const { pageRecords, getChatId } = deps + const { pageRecords, getChatId, appInfo } = deps const messages = ref([]) const loading = ref(false) @@ -72,7 +74,7 @@ export function createLogMessageListStore(deps: LogMessageListDeps) { return loadMessages(cid, currentPage.value + 1) } - return { messages, loading, hasMore, load, loadMore } + return { appInfo, messages, loading, hasMore, load, loadMore } } export type LogMessageListStore = ReturnType diff --git a/ui/src/conversation-panel/components/log-message-list/index.vue b/ui/src/conversation-panel/components/log-message-list/index.vue index 7eb9d6662f5..44cea153587 100644 --- a/ui/src/conversation-panel/components/log-message-list/index.vue +++ b/ui/src/conversation-panel/components/log-message-list/index.vue @@ -2,16 +2,26 @@ import ContentList from '../content-list/index.vue' import MessageFooter from '../message-footer/index.vue' import ReverseInfiniteScroll from '../../core/reverse-infinite-scroll/index.vue' +import { computed } from 'vue' import { useLogMessageListStore } from './index' -const { messages, loading, hasMore, loadMore } = useLogMessageListStore() +const { appInfo, messages, loading, hasMore, loadMore } = useLogMessageListStore() +const avatar = computed(() => appInfo.value?.avatar) +const userAvatar = computed(() => appInfo.value?.user_avatar) +const showAvatar = computed(() => appInfo.value?.show_avatar) +const showUserAvatar = computed(() => appInfo.value?.show_user_avatar)