Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
🐛fix: think tag auto expand like tool tag behavior (#5727)
Faisal Amir60b7e6a0819b
diff --git a/web-app/src/containers/ThinkingBlock.tsx b/web-app/src/containers/ThinkingBlock.tsxindex 88ec03b52..c4e6742c5 100644--- a/web-app/src/containers/ThinkingBlock.tsx+++ b/web-app/src/containers/ThinkingBlock.tsx@@ -12,27 +12,30 @@ interface Props {// Zustand store for thinking block statetype ThinkingBlockState = {thinkingState: { [id: string]: boolean }- toggleState: (id: string) => void+ setThinkingState: (id: string, expanded: boolean) => void}const useThinkingStore = create<ThinkingBlockState>((set) => ({thinkingState: {},- toggleState: (id) =>+ setThinkingState: (id, expanded) =>set((state) => ({thinkingState: {...state.thinkingState,- [id]: !state.thinkingState[id],+ [id]: expanded,},})),}))const ThinkingBlock = ({ id, text }: Props) => {- const { thinkingState, toggleState } = useThinkingStore()+ const { thinkingState, setThinkingState } = useThinkingStore()const { streamingContent } = useAppState()const { t } = useTranslation()const loading = !text.includes('</think>') && streamingContent- const isExpanded = thinkingState[id] ?? false- const handleClick = () => toggleState(id)+ const isExpanded = thinkingState[id] ?? (loading ? true : false)+ const handleClick = () => {+ const newExpandedState = !isExpanded+ setThinkingState(id, newExpandedState)+ }if (!text.replace(/<\/?think>/g, '').trim()) return null