-
+
+
- {{ conv.title }}
- {{ conv.messages.length }} 条消息
+ {{ shareConversation.title }}
+ {{ shareConversation.messages.length }} 条消息
@@ -120,10 +116,15 @@ const settingsStore = useSettingsStore();
const chatStore = useChatStore();
const show = computed(() => settingsStore.showShareModal);
-const { selectedConversations, selectedCount, isMessageSelectMode, selectedMessages, selectedMessageCount } = storeToRefs(chatStore);
+const { shareConversationId } = storeToRefs(settingsStore);
+const { isMessageSelectMode, selectedMessages, selectedMessageCount } = storeToRefs(chatStore);
// 是否是消息分享模式
const isMessageShare = computed(() => isMessageSelectMode.value);
+const shareConversation = computed(() => {
+ if (!shareConversationId.value) return null;
+ return chatStore.conversations.find((c) => c.id === shareConversationId.value) || null;
+});
const password = ref("");
const showPassword = ref(false);
@@ -173,16 +174,13 @@ async function handleCreateShare() {
});
} else {
// 对话分享模式
- // 检查数量限制
- if (selectedCount.value > SHARE_LIMITS.MAX_CONVERSATIONS) {
- window.$toast?.(`最多分享 ${SHARE_LIMITS.MAX_CONVERSATIONS} 个对话`, 'error');
+ if (!shareConversation.value) {
+ window.$toast?.('请先选择要分享的对话', 'error');
return;
}
- const conversationIds = selectedConversations.value.map(c => c.id);
-
result = await shareApi.createShare({
- conversationIds,
+ conversationIds: [shareConversation.value.id],
passwordHash,
expiresIn: SHARE_LIMITS.DEFAULT_EXPIRE_SECONDS,
});
@@ -207,8 +205,6 @@ async function handleCreateShare() {
password.value = "";
if (isMessageShare.value) {
chatStore.exitMessageSelectMode();
- } else {
- chatStore.exitSelectMode();
}
} catch (error) {
diff --git a/src/components/sidebar/ChatSidebar.vue b/src/components/sidebar/ChatSidebar.vue
index 634b9a5..4ed87dc 100644
--- a/src/components/sidebar/ChatSidebar.vue
+++ b/src/components/sidebar/ChatSidebar.vue
@@ -76,7 +76,7 @@