fix(frontend): deduplicate live workflow activity
This commit is contained in:
@@ -5,25 +5,17 @@ import remarkGfm from "remark-gfm";
|
||||
import type { ActivityEntry, ActivityKind } from "../api/types";
|
||||
import { useSessionStore } from "../store/sessionStore";
|
||||
import { Button } from "../components/ui/button";
|
||||
import { isNearBottom } from "./activityScroll";
|
||||
|
||||
const VISIBLE_MODEL_ACTIVITY_KINDS: ReadonlySet<ActivityKind> = new Set([
|
||||
"prompt",
|
||||
"thinking",
|
||||
"status",
|
||||
"gate",
|
||||
]);
|
||||
|
||||
export function isVisibleModelActivity(entry: ActivityEntry): boolean {
|
||||
return VISIBLE_MODEL_ACTIVITY_KINDS.has(entry.kind);
|
||||
}
|
||||
|
||||
export function isNearBottom(
|
||||
el: Pick<HTMLElement, "scrollHeight" | "clientHeight" | "scrollTop">,
|
||||
threshold = 48,
|
||||
): boolean {
|
||||
return el.scrollHeight - el.clientHeight - el.scrollTop <= threshold;
|
||||
}
|
||||
|
||||
export function formatModelActivity(text: string): string {
|
||||
return text
|
||||
.replace(/\r\n?/g, "\n")
|
||||
|
||||
Reference in New Issue
Block a user