mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-21 05:14:45 +08:00
fix: message block width (#257)
This commit is contained in:
@@ -173,7 +173,7 @@ function MessageListItem({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<MessageBubble message={message}>
|
<MessageBubble message={message}>
|
||||||
<div className="flex w-full flex-col">
|
<div className="flex w-full flex-col text-wrap break-words">
|
||||||
<Markdown
|
<Markdown
|
||||||
className={cn(
|
className={cn(
|
||||||
message.role === "user" &&
|
message.role === "user" &&
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { useEffect, useImperativeHandle, useRef, type ReactNode, type RefObject } from "react";
|
import {
|
||||||
|
useEffect,
|
||||||
|
useImperativeHandle,
|
||||||
|
useLayoutEffect,
|
||||||
|
useRef,
|
||||||
|
type ReactNode,
|
||||||
|
type RefObject,
|
||||||
|
} from "react";
|
||||||
import { useStickToBottom } from "use-stick-to-bottom";
|
import { useStickToBottom } from "use-stick-to-bottom";
|
||||||
|
|
||||||
import { ScrollArea } from "~/components/ui/scroll-area";
|
import { ScrollArea } from "~/components/ui/scroll-area";
|
||||||
@@ -26,15 +33,16 @@ export function ScrollContainer({
|
|||||||
scrollShadow = true,
|
scrollShadow = true,
|
||||||
scrollShadowColor = "var(--background)",
|
scrollShadowColor = "var(--background)",
|
||||||
autoScrollToBottom = false,
|
autoScrollToBottom = false,
|
||||||
ref
|
ref,
|
||||||
}: ScrollContainerProps) {
|
}: ScrollContainerProps) {
|
||||||
const { scrollRef, contentRef, scrollToBottom, isAtBottom } = useStickToBottom({ initial: "instant" });
|
const { scrollRef, contentRef, scrollToBottom, isAtBottom } =
|
||||||
|
useStickToBottom({ initial: "instant" });
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
scrollToBottom() {
|
scrollToBottom() {
|
||||||
if (isAtBottom) {
|
if (isAtBottom) {
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const tempScrollRef = useRef<HTMLElement>(null);
|
const tempScrollRef = useRef<HTMLElement>(null);
|
||||||
@@ -51,6 +59,14 @@ export function ScrollContainer({
|
|||||||
}
|
}
|
||||||
}, [autoScrollToBottom, contentRef, scrollRef]);
|
}, [autoScrollToBottom, contentRef, scrollRef]);
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
if (contentRef.current) {
|
||||||
|
if (contentRef.current.parentElement) {
|
||||||
|
contentRef.current.parentElement.style.display = "block";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [contentRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("relative", className)}>
|
<div className={cn("relative", className)}>
|
||||||
{scrollShadow && (
|
{scrollShadow && (
|
||||||
|
|||||||
Reference in New Issue
Block a user