mirror of
https://github.com/codeaashu/claude-code.git
synced 2026-04-08 22:28:48 +03:00
claude-code
This commit is contained in:
15
web/hooks/useConversation.ts
Normal file
15
web/hooks/useConversation.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useChatStore } from "@/lib/store";
|
||||
|
||||
export function useConversation(id: string) {
|
||||
const { conversations, addMessage, updateMessage, deleteConversation } = useChatStore();
|
||||
const conversation = conversations.find((c) => c.id === id) ?? null;
|
||||
|
||||
return {
|
||||
conversation,
|
||||
messages: conversation?.messages ?? [],
|
||||
addMessage: (msg: Parameters<typeof addMessage>[1]) => addMessage(id, msg),
|
||||
updateMessage: (msgId: string, updates: Parameters<typeof updateMessage>[2]) =>
|
||||
updateMessage(id, msgId, updates),
|
||||
deleteConversation: () => deleteConversation(id),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user