From 64c441ba36ac58550b170826c04c582df5a726c5 Mon Sep 17 00:00:00 2001
From: MT-Mint <798521692@qq.com>
Date: Tue, 31 Mar 2026 15:26:50 +0800
Subject: [PATCH] =?UTF-8?q?feat(stacked-cards):=20=E8=B0=83=E6=95=B4?=
=?UTF-8?q?=E5=8D=A1=E7=89=87=E7=BB=84=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/input/ChatInput.vue | 94 ++++++++++-----------
src/components/sidebar/ChatSidebar.vue | 7 ++
src/components/sidebar/ConversationItem.vue | 1 -
src/components/ui/StackedCards.vue | 15 ++--
4 files changed, 62 insertions(+), 55 deletions(-)
diff --git a/src/components/input/ChatInput.vue b/src/components/input/ChatInput.vue
index eb6894a..04b7c24 100644
--- a/src/components/input/ChatInput.vue
+++ b/src/components/input/ChatInput.vue
@@ -68,11 +68,11 @@
-
+
@@ -97,11 +97,11 @@ import StackedCards from "@/components/ui/StackedCards.vue";
import PlusIcon from "../icons/custom/PlusIcon.vue";
import SendIcon from "../icons/custom/SendIcon.vue";
-interface AttachmentWithProgress extends Attachment {
- uploading?: boolean;
- progress?: number;
- deleting?: boolean;
-}
+interface AttachmentWithProgress extends Attachment {
+ uploading?: boolean;
+ progress?: number;
+ deleting?: boolean;
+}
const props = withDefaults(
defineProps<{
@@ -182,19 +182,19 @@ function showThrottledToast(message: string, type: "error" = "error") {
}
// 计算属性
-const charCount = computed(() => inputText.value.length);
-const isUploading = computed(() => attachments.value.some((a) => a.uploading));
-const isProcessingAttachments = computed(() =>
- attachments.value.some((a) => a.uploading || a.deleting),
-);
-const canSend = computed(() => {
- return (
- (inputText.value.trim().length > 0 || attachments.value.length > 0) &&
- !props.disabled &&
- charCount.value <= props.maxChars &&
- !isProcessingAttachments.value
- );
-});
+const charCount = computed(() => inputText.value.length);
+const isUploading = computed(() => attachments.value.some((a) => a.uploading));
+const isProcessingAttachments = computed(() =>
+ attachments.value.some((a) => a.uploading || a.deleting),
+);
+const canSend = computed(() => {
+ return (
+ (inputText.value.trim().length > 0 || attachments.value.length > 0) &&
+ !props.disabled &&
+ charCount.value <= props.maxChars &&
+ !isProcessingAttachments.value
+ );
+});
// 自动调整高度
function autoResize() {
@@ -382,28 +382,28 @@ async function uploadFileToServer(id: string, file: File) {
}
// 移除附件
-async function removeAttachment(id: string | number) {
- const targetId = String(id);
- const index = attachments.value.findIndex((a) => a.id === targetId);
- if (index === -1) return;
-
- const attachment = attachments.value[index];
- let deletedFromOss = false;
-
- // 如果已上传到 OSS(不是本地 blob URL),则从 OSS 删除
- if (attachment.url && !attachment.url.startsWith("blob:")) {
- try {
- attachment.deleting = true;
- await nextTick();
- await chatApi.deleteAttachment(attachment.url);
- deletedFromOss = true;
- } catch (error) {
- console.error("删除 OSS 文件失败:", error);
- // 即使删除失败也继续移除本地引用
- } finally {
- attachment.deleting = false;
- }
- }
+async function removeAttachment(id: string | number) {
+ const targetId = String(id);
+ const index = attachments.value.findIndex((a) => a.id === targetId);
+ if (index === -1) return;
+
+ const attachment = attachments.value[index];
+ let deletedFromOss = false;
+
+ // 如果已上传到 OSS(不是本地 blob URL),则从 OSS 删除
+ if (attachment.url && !attachment.url.startsWith("blob:")) {
+ try {
+ attachment.deleting = true;
+ await nextTick();
+ await chatApi.deleteAttachment(attachment.url);
+ deletedFromOss = true;
+ } catch (error) {
+ console.error("删除 OSS 文件失败:", error);
+ // 即使删除失败也继续移除本地引用
+ } finally {
+ attachment.deleting = false;
+ }
+ }
// 释放 blob URL(如果是本地的)
if (attachment.url.startsWith("blob:")) {
@@ -718,8 +718,8 @@ onMounted(() => {
display: grid;
place-items: center;
border-radius: 0;
- width: 88px;
- height: 118px;
+ width: 50px;
+ height: 70px;
background-color: rgb(255, 255, 255);
}
diff --git a/src/components/sidebar/ChatSidebar.vue b/src/components/sidebar/ChatSidebar.vue
index a353d95..5fc5be0 100644
--- a/src/components/sidebar/ChatSidebar.vue
+++ b/src/components/sidebar/ChatSidebar.vue
@@ -625,6 +625,13 @@ onBeforeUnmount(() => {
}
}
+.group-list{
+ gap:5px;
+ display:flex;
+ flex-direction:column;
+ padding: 0 20px;
+}
+
.empty-state {
margin: auto 0;
display: flex;
diff --git a/src/components/sidebar/ConversationItem.vue b/src/components/sidebar/ConversationItem.vue
index 3d0ed4f..cfeffe6 100644
--- a/src/components/sidebar/ConversationItem.vue
+++ b/src/components/sidebar/ConversationItem.vue
@@ -175,7 +175,6 @@ function handleDelete() {
align-items: center;
gap: 10px;
padding: 10px 12px;
- margin: 2px 8px;
border-radius: 10px;
cursor: pointer;
diff --git a/src/components/ui/StackedCards.vue b/src/components/ui/StackedCards.vue
index 82cc02a..0f756cc 100644
--- a/src/components/ui/StackedCards.vue
+++ b/src/components/ui/StackedCards.vue
@@ -1,6 +1,7 @@