added more pomidoro
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user