fix lint issue
This commit is contained in:
parent
e6bc1182a6
commit
191e6f9714
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
|
||||||
import ReactMarkdown, { Components } from 'react-markdown'
|
import ReactMarkdown, { Components } from 'react-markdown'
|
||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import remarkEmoji from 'remark-emoji'
|
import remarkEmoji from 'remark-emoji'
|
||||||
|
|||||||
@ -131,7 +131,7 @@ export const useChat = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
return currentThread
|
return currentThread
|
||||||
}, [createThread, retrieveThread, router])
|
}, [createThread, retrieveThread, router, setMessages])
|
||||||
|
|
||||||
const restartModel = useCallback(
|
const restartModel = useCallback(
|
||||||
async (provider: ProviderObject, modelId: string) => {
|
async (provider: ProviderObject, modelId: string) => {
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export const useThreadScrolling = (
|
|||||||
return () =>
|
return () =>
|
||||||
scrollContainer.removeEventListener('scroll', handleScroll)
|
scrollContainer.removeEventListener('scroll', handleScroll)
|
||||||
}
|
}
|
||||||
}, [handleScroll])
|
}, [handleScroll, scrollContainerRef])
|
||||||
|
|
||||||
const checkScrollState = useCallback(() => {
|
const checkScrollState = useCallback(() => {
|
||||||
const scrollContainer = scrollContainerRef.current
|
const scrollContainer = scrollContainerRef.current
|
||||||
@ -90,7 +90,7 @@ export const useThreadScrolling = (
|
|||||||
|
|
||||||
setIsAtBottom(isBottom)
|
setIsAtBottom(isBottom)
|
||||||
setHasScrollbar(hasScroll)
|
setHasScrollbar(hasScroll)
|
||||||
}, [])
|
}, [scrollContainerRef])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!scrollContainerRef.current) return
|
if (!scrollContainerRef.current) return
|
||||||
@ -101,7 +101,7 @@ export const useThreadScrolling = (
|
|||||||
scrollToBottom(false)
|
scrollToBottom(false)
|
||||||
checkScrollState()
|
checkScrollState()
|
||||||
}
|
}
|
||||||
}, [checkScrollState, scrollToBottom])
|
}, [checkScrollState, scrollToBottom, scrollContainerRef])
|
||||||
|
|
||||||
|
|
||||||
const prevCountRef = useRef(messageCount)
|
const prevCountRef = useRef(messageCount)
|
||||||
@ -146,7 +146,7 @@ export const useThreadScrolling = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
prevCountRef.current = messageCount
|
prevCountRef.current = messageCount
|
||||||
}, [messageCount, lastMessageRole])
|
}, [messageCount, lastMessageRole, getDOMElements, setPaddingHeight])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const previouslyStreaming = wasStreamingRef.current
|
const previouslyStreaming = wasStreamingRef.current
|
||||||
@ -197,7 +197,7 @@ export const useThreadScrolling = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
wasStreamingRef.current = currentlyStreaming
|
wasStreamingRef.current = currentlyStreaming
|
||||||
}, [streamingContent, threadId])
|
}, [streamingContent, threadId, getDOMElements, setPaddingHeight])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
userIntendedPositionRef.current = null
|
userIntendedPositionRef.current = null
|
||||||
@ -207,7 +207,7 @@ export const useThreadScrolling = (
|
|||||||
prevCountRef.current = messageCount
|
prevCountRef.current = messageCount
|
||||||
scrollToBottom(false)
|
scrollToBottom(false)
|
||||||
checkScrollState()
|
checkScrollState()
|
||||||
}, [threadId])
|
}, [threadId, messageCount, scrollToBottom, checkScrollState, setPaddingHeight])
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import ScrollToBottom from '@/containers/ScrollToBottom'
|
|||||||
import { PromptProgress } from '@/components/PromptProgress'
|
import { PromptProgress } from '@/components/PromptProgress'
|
||||||
import { ThreadPadding } from '@/containers/ThreadPadding'
|
import { ThreadPadding } from '@/containers/ThreadPadding'
|
||||||
import { TEMPORARY_CHAT_ID, TEMPORARY_CHAT_QUERY_ID } from '@/constants/chat'
|
import { TEMPORARY_CHAT_ID, TEMPORARY_CHAT_QUERY_ID } from '@/constants/chat'
|
||||||
import { useThreadScrolling } from '@/hooks/useThreadScrolling'
|
|
||||||
import { IconInfoCircle } from '@tabler/icons-react'
|
import { IconInfoCircle } from '@tabler/icons-react'
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
|
||||||
|
|
||||||
@ -100,9 +99,6 @@ function ThreadDetail() {
|
|||||||
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
|
|
||||||
// Get padding height for ChatGPT-style message positioning
|
|
||||||
const { paddingHeight } = useThreadScrolling(threadId, scrollContainerRef)
|
|
||||||
|
|
||||||
// Listen for conversation not found events
|
// Listen for conversation not found events
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleConversationNotFound = (event: CustomEvent) => {
|
const handleConversationNotFound = (event: CustomEvent) => {
|
||||||
@ -124,7 +120,7 @@ function ThreadDetail() {
|
|||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener(CONVERSATION_NOT_FOUND_EVENT, handleConversationNotFound as EventListener)
|
window.removeEventListener(CONVERSATION_NOT_FOUND_EVENT, handleConversationNotFound as EventListener)
|
||||||
}
|
}
|
||||||
}, [threadId, navigate])
|
}, [threadId, navigate, t])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentThreadId(threadId)
|
setCurrentThreadId(threadId)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user