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: thinking render with long content

Faisal Amir7be455275eaa
diff --git a/web-app/src/components/ai-elements/reasoning.tsx b/web-app/src/components/ai-elements/reasoning.tsx
index 2aa135525..9316e5059 100644
--- a/web-app/src/components/ai-elements/reasoning.tsx
+++ b/web-app/src/components/ai-elements/reasoning.tsx
@@ -13,6 +13,7 @@ import {
memo,
useContext,
useEffect,
+ useMemo,
useRef,
useState,
} from 'react'
@@ -95,10 +96,18 @@ export const Reasoning = memo(
setIsOpen(newOpen)
}
+ const contextValue = useMemo(
+ () => ({
+ isStreaming,
+ isOpen,
+ setIsOpen,
+ duration,
+ }),
+ [isStreaming, isOpen, duration]
+ )
+
return (
- <ReasoningContext.Provider
- value={{ isStreaming, isOpen, setIsOpen, duration }}
- >
+ <ReasoningContext.Provider value={contextValue}>
<Collapsible
className={cn('not-prose mb-4', className)}
onOpenChange={handleOpenChange}