Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ui/src/conversation-panel/components/header/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ const props = defineProps<{
/** 显示分享入口;仅对话端传入 */
shareable?: boolean
}>()

const emit = defineEmits<{ share: [] }>()

const list = useConversationListStore()

const msgs = useMessageListStore()
// 回答生成中或没有消息时不可分享
const canShare = computed(() => msgs.messages.value.length > 0 && !msgs.streamLoading.value)
Expand Down Expand Up @@ -43,7 +41,7 @@ const handleNewConversation = () => (props.newConversation ? props.newConversati
</MkTooltip>
<!-- 进入分享模式,勾选要分享的对话 -->
<MkTooltip v-if="shareable" content="分享">
<el-button text :disabled="!canShare" @click="emit('share')">
<el-button text :disabled="!canShare" @click="list.switchShared(true)">
<MkIcon name="icon_share_outlined" :size="18" :class="canShare ? 'text-N900!' : 'text-N400!'" />
</el-button>
</MkTooltip>
Expand Down
20 changes: 10 additions & 10 deletions ui/src/conversation-panel/components/message-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ import PrologueContent from '../prologue-content/index.vue'
import { formatPrologue } from '../prologue-content/index'
import ReverseInfiniteScroll from '../../core/reverse-infinite-scroll/index.vue'
import { useMessageListStore } from './index'

import { useConversationListStore } from '../../left-sidebar/conversation-list/index'
defineProps<{ appName?: string }>()

const { appInfo, messages, loading, streamLoading, hasMore, loadMore, onStreamProgress } = useMessageListStore()
const {
// 是否分享
isShared,
// 切换分享
switchShared } = useConversationListStore()
const scrollRef = ref<InstanceType<typeof ReverseInfiniteScroll>>()

// 开场白随智能体信息变化(debug 保存后为最新草稿)
Expand All @@ -25,14 +30,8 @@ const showUserAvatar = computed(() => appInfo.value?.show_user_avatar)
</script>

<template>
<ReverseInfiniteScroll
ref="scrollRef"
content-class="mk-conversation-content p-4"
:loading="loading"
:has-more="hasMore"
:count="messages.length"
:load-more="loadMore"
>
<ReverseInfiniteScroll ref="scrollRef" content-class="mk-conversation-content p-4" :loading="loading"
:has-more="hasMore" :count="messages.length" :load-more="loadMore">
<template #prepend>
<!-- 开场白在空会话或历史全部加载后显示,固定在会话最前 -->
<div v-if="prologue && (!messages.length || !hasMore)">
Expand All @@ -48,7 +47,8 @@ const showUserAvatar = computed(() => appInfo.value?.show_user_avatar)
<el-avatar v-if="userAvatar" class="bg-transparent!" shape="square" :size="24">
<img :src="userAvatar" alt="" />
</el-avatar>
<el-avatar v-else :size="24" :style="{ background: appInfo?.custom_theme?.theme_color || 'var(--mk-primary-gradient)' }">
<el-avatar v-else :size="24"
:style="{ background: appInfo?.custom_theme?.theme_color || 'var(--mk-primary-gradient)' }">
<img src="@/assets/mk_icon_user_gradient.svg" alt="" style="width: 50%" />
</el-avatar>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export function createConversationListStore(deps: ConversationListDeps) {
const pageSize = 50
const currentPage = ref(1)
const hasMore = ref(true)

const isShared = ref<boolean>(false)
const switchShared=(share:boolean)=>{
isShared.value=share
}
const loadConversations = async (page = 1) => {
try {
const response = await pageConversations(page, pageSize)
Expand Down Expand Up @@ -98,6 +101,8 @@ export function createConversationListStore(deps: ConversationListDeps) {
}

return {
isShared,
switchShared,
conversations,
currentChatId,
currentConversation,
Expand Down
3 changes: 3 additions & 0 deletions ui/src/conversation-panel/main/chat-panel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const list = useConversationListStore()
const input = useMessageInputStore()
// 拖拽到面板任意处 → 交给 message-input 接收文件
const handleDrop = (e: DragEvent) => input.addFiles(e.dataTransfer?.files)



</script>
<template>
<!-- 带输入框的主面板:header + message-list + message-input -->
Expand Down
Loading