chore: thinking block auto collapse when streaming finish (#5202)

* chore: thinking block  auto collapse when streaming finish

* chore: fix padding
This commit is contained in:
Faisal Amir 2025-06-05 14:29:33 +07:00 committed by GitHub
parent 8ee4969aa9
commit a84034c552
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 6 deletions

View File

@ -5,13 +5,13 @@ import { useAppState } from '@/hooks/useAppState'
interface Props {
text: string
id: number
id: string
}
// Zustand store for thinking block state
type ThinkingBlockState = {
thinkingState: { [id: number]: boolean }
toggleState: (id: number) => void
thinkingState: { [id: string]: boolean }
toggleState: (id: string) => void
}
const useThinkingStore = create<ThinkingBlockState>((set) => ({
@ -57,7 +57,7 @@ const ThinkingBlock = ({ id, text }: Props) => {
</div>
{isExpanded && (
<div className="mt-2 pl-6 text-main-view-fg/60">
<div className="mt-2 pl-6 pr-4 text-main-view-fg/60">
<RenderMarkdown content={text.replace(/<\/?think>/g, '').trim()} />
</div>
)}

View File

@ -300,7 +300,11 @@ export const ThreadContent = memo(
{reasoningSegment && (
<ThinkingBlock
id={item.index ?? Number(item.id)}
id={
item.isLastMessage
? `${item.thread_id}-last`
: `${item.thread_id}-${item.index ?? item.id}`
}
text={reasoningSegment}
/>
)}

View File

@ -35,7 +35,7 @@ export default defineConfig(({ mode }) => {
process.env.TAURI_ENV_PLATFORM?.includes('windows') ?? 'false'
),
IS_LINUX: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('unix') ?? 'false'
process.env.TAURI_ENV_PLATFORM?.includes('linux') ?? 'false'
),
IS_IOS: JSON.stringify(
process.env.TAURI_ENV_PLATFORM?.includes('ios') ?? 'false'