added more pomidoro

This commit is contained in:
2026-06-09 11:54:32 +03:00
parent 244935e4ac
commit c8599b3d13
20 changed files with 817 additions and 91 deletions
+10 -1
View File
@@ -26,7 +26,8 @@ export default function Chat() {
const [streaming, setStreaming] = useState("");
const [liveNotices, setLiveNotices] = useState<string[]>([]);
const bottomRef = useRef<HTMLDivElement>(null);
const { refresh: refreshPomodoro } = usePomodoro();
const { status: pomodoroStatus, refresh: refreshPomodoro } = usePomodoro();
const [lastNotifySeq, setLastNotifySeq] = useState(0);
const loadSessions = async () => {
const data = await api.listSessions();
@@ -55,6 +56,14 @@ export default function Chat() {
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
}, [messages, streaming, liveNotices]);
useEffect(() => {
const seq = pomodoroStatus?.cycle?.chat_notify_seq ?? 0;
if (seq > lastNotifySeq && activeId) {
setLastNotifySeq(seq);
loadMessages(activeId).catch(console.error);
}
}, [pomodoroStatus?.cycle?.chat_notify_seq, activeId, lastNotifySeq]);
const handleNewChat = async () => {
const session = await api.createSession();
await loadSessions();