Агент не меняет статус принятой задачи (причина противоречия в PEP-204); «Посмотреть результат» / «Принять» / «Поправить» в сообщении «готово»; переписка сверху вниз с полем ввода внизу; строка состояния вместо служебных сообщений; компактные события; очистка «Всех событий»; выбор проекта списком; «Задача описана. Начать работу?». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
830 B
TypeScript
21 lines
830 B
TypeScript
"use client";
|
|
// PEP-207: a conversation opens at the first unread message (or at its end); a new message
|
|
// arriving while the reader is at the bottom keeps them at the bottom.
|
|
import { useEffect, useRef } from "react";
|
|
|
|
export function ChatScroll({ lastId }: { lastId: number }) {
|
|
const first = useRef(true);
|
|
useEffect(() => {
|
|
const end = document.querySelector("[data-chat-end]");
|
|
if (first.current) {
|
|
first.current = false;
|
|
const unread = document.querySelector("[data-first-unread]");
|
|
(unread ?? end)?.scrollIntoView({ block: unread ? "center" : "end" });
|
|
return;
|
|
}
|
|
const nearBottom = window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 320;
|
|
if (nearBottom) end?.scrollIntoView({ block: "end", behavior: "smooth" });
|
|
}, [lastId]);
|
|
return null;
|
|
}
|