Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync main to dev after 0.5.10 #4194

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@
import { getCurrentChatMessagesAtom } from '@/helpers/atoms/ChatMessage.atom'

const ChatConfigurator = memo(() => {
const messages = useAtomValue(getCurrentChatMessagesAtom)

Check warning on line 19 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

19 line is not covered with tests

const [current, setCurrent] = useState<ThreadMessage[]>([])
const loadModelError = useAtomValue(loadModelErrorAtom)

Check warning on line 22 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

21-22 lines are not covered with tests

const isMessagesIdentificial = (

Check warning on line 24 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

24 line is not covered with tests
arr1: ThreadMessage[],
arr2: ThreadMessage[]
): boolean => {
if (arr1.length !== arr2.length) return false
return arr1.every((item, index) => item.id === arr2[index].id)

Check warning on line 29 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

28-29 lines are not covered with tests
}

useEffect(() => {
if (

Check warning on line 33 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

32-33 lines are not covered with tests
messages?.length !== current?.length ||
!isMessagesIdentificial(messages, current)
) {
setCurrent(messages)

Check warning on line 37 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

37 line is not covered with tests
}
}, [messages, current, loadModelError])

if (!messages.length) return <EmptyThread />

Check warning on line 41 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

41 line is not covered with tests
return (
<div className="flex h-full w-full flex-col">
<ChatBody loadModelError={loadModelError} messages={current} />
Expand All @@ -55,15 +55,15 @@
loadModelError?: string
}) => {
// The scrollable element for your list
const parentRef = useRef(null)

Check warning on line 58 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

58 line is not covered with tests

const count = useMemo(
() => (messages?.length ?? 0) + (loadModelError ? 1 : 0),

Check warning on line 61 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

60-61 lines are not covered with tests
[messages, loadModelError]
)

// The virtualizer
const virtualizer = useVirtualizer({

Check warning on line 66 in web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

66 line is not covered with tests
count,
getScrollElement: () => parentRef.current,
estimateSize: () => 35,
Expand All @@ -88,7 +88,7 @@
}

return (
<div className="scroll-area flex h-full w-full flex-col overflow-x-hidden">
<div className="flex h-full w-full flex-col overflow-x-hidden">
<div
ref={parentRef}
className="List"
Expand Down
Loading