From a2c90214ad2d325c8b3d1ce1e0e0c3f66560ef76 Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Wed, 23 Aug 2023 17:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../conversations/ConversationSidebar.tsx | 71 ++++++++------- .../conversations/ConversationSidebarItem.tsx | 2 + src/components/main/Conversation.tsx | 73 +++++++++------- src/components/ui/Sidebar.tsx | 4 +- src/pages/chat/components/dataList.tsx | 87 +++++++++++++++---- src/pages/chat/components/iframe.tsx | 19 ++++ src/pages/chat/components/listItem.tsx | 7 +- src/pages/chat/css/list.css | 17 ++++ src/pages/chat/datalist.astro | 21 ----- src/pages/chat/datalist.tsx | 23 +++++ src/pages/chat/ts/store.ts | 3 + src/pages/index.astro | 1 + 12 files changed, 221 insertions(+), 107 deletions(-) create mode 100644 src/pages/chat/components/iframe.tsx delete mode 100644 src/pages/chat/datalist.astro create mode 100644 src/pages/chat/datalist.tsx create mode 100644 src/pages/chat/ts/store.ts diff --git a/src/components/conversations/ConversationSidebar.tsx b/src/components/conversations/ConversationSidebar.tsx index 337dddd..5eadef4 100644 --- a/src/components/conversations/ConversationSidebar.tsx +++ b/src/components/conversations/ConversationSidebar.tsx @@ -6,12 +6,13 @@ import ConversationSidebarItem from './ConversationSidebarItem' import ConversationSidebarAdd from './ConversationSidebarAdd' import { addConversation } from '@/stores/conversation' import { showConversationEditModal } from '@/stores/ui' +import ChatList from '../../pages/chat/datalist' export default () => { const { t } = useI18n() const $conversationMapSortList = useStore(conversationMapSortList) - //设置副标题数字 + //设置副标题数字 const setNameNum = (setName: string, numList: any) => { let list = conversationMapSortList.get() let title = '' @@ -24,7 +25,7 @@ export default () => { count = Math.max(count, Number(num[0].replace('(', '').replace(')', ''))) } }) - title =count?`${setName}(${count + 1})`:`${setName}${numList.length>0?'(1)':''}` + title = count ? `${setName}(${count + 1})` : `${setName}${numList.length > 0 ? '(1)' : ''}` return title } @@ -36,46 +37,50 @@ export default () => { } } - onMount(() => { - setTimeout(() => { - let itemList = conversationMapSortList.get() - let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any)||'未命名对话' - let numList: number[] = [] - itemList.map((res, i) => { - if (checkName(res.name, setName.name)) numList.push(i) - }) + // onMount(() => { + // return + // setTimeout(() => { + // let itemList = conversationMapSortList.get() + // let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any) || '未命名对话' + // let numList: number[] = [] + // itemList.map((res, i) => { + // if (checkName(res.name, setName.name)) numList.push(i) + // }) - if(setName.switch){ - addConversation({name:setNameNum(setName.name, numList),systemInfo:setName.systemInfo}) - showConversationEditModal.set(true) - setName.switch=false - sessionStorage.setItem('dialogueName',JSON.stringify({name:setName.name,switch:false})) - } - }, 1000) - }) + // if (setName.switch) { + // addConversation({ name: setNameNum(setName.name, numList), systemInfo: setName.systemInfo }) + // showConversationEditModal.set(true) + // setName.switch = false + // sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false })) + // } + // }, 1000) + // }) return ( -