Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix lint issue

Dinh Long Nguyen191e6f9714ec
diff --git a/web-app/src/containers/RenderMarkdown.tsx b/web-app/src/containers/RenderMarkdown.tsx
index 31d08cf10..c941b512d 100644
--- a/web-app/src/containers/RenderMarkdown.tsx
+++ b/web-app/src/containers/RenderMarkdown.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react-hooks/exhaustive-deps */
import ReactMarkdown, { Components } from 'react-markdown'
import remarkGfm from 'remark-gfm'
import remarkEmoji from 'remark-emoji'
diff --git a/web-app/src/hooks/useChat.ts b/web-app/src/hooks/useChat.ts
index 357fc3a8d..935458326 100644
--- a/web-app/src/hooks/useChat.ts
+++ b/web-app/src/hooks/useChat.ts
@@ -131,7 +131,7 @@ export const useChat = () => {
})
}
return currentThread
- }, [createThread, retrieveThread, router])
+ }, [createThread, retrieveThread, router, setMessages])
const restartModel = useCallback(
async (provider: ProviderObject, modelId: string) => {
diff --git a/web-app/src/hooks/useThreadScrolling.tsx b/web-app/src/hooks/useThreadScrolling.tsx
index 41362db61..a3c6d7ed2 100644
--- a/web-app/src/hooks/useThreadScrolling.tsx
+++ b/web-app/src/hooks/useThreadScrolling.tsx
@@ -78,7 +78,7 @@ export const useThreadScrolling = (
return () =>
scrollContainer.removeEventListener('scroll', handleScroll)
}
- }, [handleScroll])
+ }, [handleScroll, scrollContainerRef])
const checkScrollState = useCallback(() => {
const scrollContainer = scrollContainerRef.current
@@ -90,7 +90,7 @@ export const useThreadScrolling = (
setIsAtBottom(isBottom)
setHasScrollbar(hasScroll)
- }, [])
+ }, [scrollContainerRef])
useEffect(() => {
if (!scrollContainerRef.current) return
@@ -101,7 +101,7 @@ export const useThreadScrolling = (
scrollToBottom(false)
checkScrollState()
}
- }, [checkScrollState, scrollToBottom])
+ }, [checkScrollState, scrollToBottom, scrollContainerRef])
const prevCountRef = useRef(messageCount)
@@ -146,7 +146,7 @@ export const useThreadScrolling = (
}
prevCountRef.current = messageCount
- }, [messageCount, lastMessageRole])
+ }, [messageCount, lastMessageRole, getDOMElements, setPaddingHeight])
useEffect(() => {
const previouslyStreaming = wasStreamingRef.current
@@ -197,7 +197,7 @@ export const useThreadScrolling = (
}
wasStreamingRef.current = currentlyStreaming
- }, [streamingContent, threadId])
+ }, [streamingContent, threadId, getDOMElements, setPaddingHeight])
useEffect(() => {
userIntendedPositionRef.current = null
@@ -207,7 +207,7 @@ export const useThreadScrolling = (
prevCountRef.current = messageCount
scrollToBottom(false)
checkScrollState()
- }, [threadId])
+ }, [threadId, messageCount, scrollToBottom, checkScrollState, setPaddingHeight])
return useMemo(
() => ({
diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsx
index adfa8b140..a10c96ede 100644
--- a/web-app/src/routes/threads/$threadId.tsx
+++ b/web-app/src/routes/threads/$threadId.tsx
@@ -25,7 +25,6 @@ import ScrollToBottom from '@/containers/ScrollToBottom'
import { PromptProgress } from '@/components/PromptProgress'
import { ThreadPadding } from '@/containers/ThreadPadding'
import { TEMPORARY_CHAT_ID, TEMPORARY_CHAT_QUERY_ID } from '@/constants/chat'
-import { useThreadScrolling } from '@/hooks/useThreadScrolling'
import { IconInfoCircle } from '@tabler/icons-react'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
@@ -100,9 +99,6 @@ function ThreadDetail() {
const scrollContainerRef = useRef<HTMLDivElement>(null)
- // Get padding height for ChatGPT-style message positioning
- const { paddingHeight } = useThreadScrolling(threadId, scrollContainerRef)
-
// Listen for conversation not found events
useEffect(() => {
const handleConversationNotFound = (event: CustomEvent) => {
@@ -124,7 +120,7 @@ function ThreadDetail() {
return () => {
window.removeEventListener(CONVERSATION_NOT_FOUND_EVENT, handleConversationNotFound as EventListener)
}
- }, [threadId, navigate])
+ }, [threadId, navigate, t])
useEffect(() => {
setCurrentThreadId(threadId)