File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/kit/src/vue/conversation Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -118,15 +118,13 @@ export const useConversation = (options: UseConversationOptions): UseConversatio
118118 . then ( ( list ) => {
119119 // 如果加载的列表为空,直接返回
120120 if ( ! list ?. length ) {
121- options . onLoad ?.( [ ] )
122- return
121+ return [ ]
123122 }
124123
125124 // 如果当前内存中的会话列表为空,直接使用加载的列表
126125 if ( conversations . value . length === 0 ) {
127126 conversations . value = list
128- options . onLoad ?.( conversations . value )
129- return
127+ return conversations . value
130128 }
131129
132130 // 合并策略:内存数据优先于存储数据
@@ -140,11 +138,14 @@ export const useConversation = (options: UseConversationOptions): UseConversatio
140138 }
141139 } )
142140 conversations . value = Array . from ( merged . values ( ) )
143- options . onLoad ?.( conversations . value )
144141
145142 // 确保 activeConversation 对应的会话在合并后的列表中
146143 // 如果 activeConversationId 存在但对应的会话不在列表中,说明可能被意外删除
147144 // 这种情况下,activeConversation 会自动变为 null(通过 computed 属性)
145+ return conversations . value
146+ } )
147+ . then ( ( loadedList ) => {
148+ options . onLoad ?.( loadedList )
148149 } )
149150 . catch ( ( error ) => {
150151 console . error ( '[useConversation] loadConversations failed:' , error )
You can’t perform that action at this time.
0 commit comments