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 ( -