diff --git a/app/packages/web/src/components/Share.tsx b/app/packages/web/src/components/Share.tsx index 78f901f67..c1c82d4b3 100644 --- a/app/packages/web/src/components/Share.tsx +++ b/app/packages/web/src/components/Share.tsx @@ -54,7 +54,7 @@ function getPartTitle(role: string, type: string): string | undefined { : role === "user" ? undefined : type === "text" - ? "AI" + ? undefined : type } @@ -69,36 +69,38 @@ function getStatusText(status: [Status, string?]): string { } } -function TextPart(props: { text: string, highlight?: boolean }) { +function TextPart( + props: { text: string, expand?: boolean, highlight?: boolean } +) { const [expanded, setExpanded] = createSignal(false) - const [overflowed, setOverflowed] = createSignal(false); - let preEl: HTMLPreElement | undefined; + const [overflowed, setOverflowed] = createSignal(false) + let preEl: HTMLPreElement | undefined - const checkOverflow = () => { - if (preEl) { - setOverflowed(preEl.scrollHeight > preEl.clientHeight + 1); + function checkOverflow() { + if (preEl && !props.expand) { + setOverflowed(preEl.scrollHeight > preEl.clientHeight + 1) } - }; + } onMount(() => { - checkOverflow(); - window.addEventListener('resize', checkOverflow); - }); + checkOverflow() + window.addEventListener("resize", checkOverflow) + }) createEffect(() => { - props.text; - setTimeout(checkOverflow, 0); - }); + props.text + setTimeout(checkOverflow, 0) + }) onCleanup(() => { - window.removeEventListener('resize', checkOverflow); - }); + window.removeEventListener("resize", checkOverflow) + }) return (
 (preEl = el)}>{props.text}
{overflowed() && @@ -114,6 +116,16 @@ function TextPart(props: { text: string, highlight?: boolean }) { ) } +function PartFooter(props: { time: number }) { + return ( + + {DateTime.fromMillis(props.time).toLocaleString(DateTime.TIME_WITH_SECONDS)} + + ) +} + export default function Share(props: { api: string }) { let params = new URLSearchParams(document.location.search) const sessionId = params.get("id") @@ -224,16 +236,6 @@ export default function Share(props: { api: string }) { }) }) - function renderTime(time: number) { - return ( - - {DateTime.fromMillis(time).toLocaleString(DateTime.TIME_WITH_SECONDS)} - - ) - } - const metrics = createMemo(() => { const result = { cost: 0, @@ -268,8 +270,8 @@ export default function Share(props: { api: string }) {