fix the learning
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-06-26 16:09:04 +01:00
parent 4ae37e84dd
commit 1e0a4c97b3
9 changed files with 623 additions and 32 deletions

View File

@@ -19,6 +19,10 @@ type ChatSessionData = {
messages: MentorChatMessage[];
};
type SendChatResponse = {
memorySuggestions?: unknown[];
};
export function useMentorChat(sessionId: string | null) {
const queryClient = useQueryClient();
const bottomRef = useRef<HTMLDivElement>(null);
@@ -54,7 +58,7 @@ export function useMentorChat(sessionId: string | null) {
const body = await res.json().catch(() => ({}));
throw new Error(body.error ?? "Send failed");
}
return res.json();
return res.json() as Promise<SendChatResponse>;
},
onMutate: (content) => {
setInput("");
@@ -64,6 +68,8 @@ export function useMentorChat(sessionId: string | null) {
setPendingState(null);
queryClient.invalidateQueries({ queryKey: ["chat-session", sessionId] });
queryClient.invalidateQueries({ queryKey: ["chat-sessions"] });
queryClient.invalidateQueries({ queryKey: ["ai-memory-suggestions"] });
queryClient.invalidateQueries({ queryKey: ["ai-knows"] });
},
onError: (_err, content) => {
setPendingState(createPendingStateOnError(content));