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.

Merge branch 'fix/thread-rerender-issue' of https://github.com/menloresearch/jan into fix/thread-rerender-issue

Dinh Long Nguyenc5c39f22e6cd
diff --cc web-app/src/containers/ThinkingBlock.tsx
index 9afc75164,be33ae70e..68ab8644f
--- a/web-app/src/containers/ThinkingBlock.tsx
+++ b/web-app/src/containers/ThinkingBlock.tsx
@@@ -27,13 -27,16 +27,16 @@@ const useThinkingStore = create<Thinkin
}))
const ThinkingBlock = ({ id, text }: Props) => {
- const { thinkingState, setThinkingState } = useThinkingStore()
+ const thinkingState = useThinkingStore((state) => state.thinkingState)
+ const setThinkingState = useThinkingStore((state) => state.setThinkingState)
- const streamingContent = useAppState((state) => state.streamingContent)
+ const isStreaming = useAppState((state) => !!state.streamingContent)
const { t } = useTranslation()
// Check for thinking formats
const hasThinkTag = text.includes('<think>') && !text.includes('</think>')
- const hasAnalysisChannel = text.includes('<|channel|>analysis<|message|>') && !text.includes('<|start|>assistant<|channel|>final<|message|>')
+ const hasAnalysisChannel =
+ text.includes('<|channel|>analysis<|message|>') &&
+ !text.includes('<|start|>assistant<|channel|>final<|message|>')
- const loading = (hasThinkTag || hasAnalysisChannel) && streamingContent
+ const loading = (hasThinkTag || hasAnalysisChannel) && isStreaming
const isExpanded = thinkingState[id] ?? (loading ? true : false)
const handleClick = () => {
const newExpandedState = !isExpanded
diff --cc web-app/src/containers/TokenSpeedIndicator.tsx
index 704a78995,262ea32a2..7638c0804
--- a/web-app/src/containers/TokenSpeedIndicator.tsx
+++ b/web-app/src/containers/TokenSpeedIndicator.tsx
@@@ -39,6 -39,6 +40,6 @@@ export const TokenSpeedIndicator = memo
</span>
</div>
)
-}
+})
- export default TokenSpeedIndicator
+ export default memo(TokenSpeedIndicator)