mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-14 19:41:09 +00:00
添加清理过时对话的功能,更新聊天管理器以支持删除旧版本,优化查找最新对话的逻辑,并在聊天历史视图中添加清理按钮。
This commit is contained in:
@@ -17,6 +17,7 @@ type UseChatHistory = {
|
||||
getChatMessagesById: (id: string) => Promise<ChatMessage[] | null>
|
||||
updateConversationTitle: (id: string, title: string) => Promise<void>
|
||||
chatList: ChatConversationMeta[]
|
||||
cleanupOutdatedChats: () => Promise<number>
|
||||
}
|
||||
|
||||
export function useChatHistory(): UseChatHistory {
|
||||
@@ -111,11 +112,18 @@ export function useChatHistory(): UseChatHistory {
|
||||
[chatManager, fetchChatList],
|
||||
)
|
||||
|
||||
const cleanupOutdatedChats = useCallback(async (): Promise<number> => {
|
||||
const count = await chatManager.cleanupOutdatedChats()
|
||||
await fetchChatList()
|
||||
return count
|
||||
}, [chatManager, fetchChatList])
|
||||
|
||||
return {
|
||||
createOrUpdateConversation,
|
||||
deleteConversation,
|
||||
getChatMessagesById,
|
||||
updateConversationTitle,
|
||||
chatList,
|
||||
cleanupOutdatedChats,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user