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:
parent
8ee4969aa9
commit
a84034c552
@ -5,13 +5,13 @@ import { useAppState } from '@/hooks/useAppState'
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
text: string
|
text: string
|
||||||
id: number
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zustand store for thinking block state
|
// Zustand store for thinking block state
|
||||||
type ThinkingBlockState = {
|
type ThinkingBlockState = {
|
||||||
thinkingState: { [id: number]: boolean }
|
thinkingState: { [id: string]: boolean }
|
||||||
toggleState: (id: number) => void
|
toggleState: (id: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const useThinkingStore = create<ThinkingBlockState>((set) => ({
|
const useThinkingStore = create<ThinkingBlockState>((set) => ({
|
||||||
@ -57,7 +57,7 @@ const ThinkingBlock = ({ id, text }: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isExpanded && (
|
{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()} />
|
<RenderMarkdown content={text.replace(/<\/?think>/g, '').trim()} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -300,7 +300,11 @@ export const ThreadContent = memo(
|
|||||||
|
|
||||||
{reasoningSegment && (
|
{reasoningSegment && (
|
||||||
<ThinkingBlock
|
<ThinkingBlock
|
||||||
id={item.index ?? Number(item.id)}
|
id={
|
||||||
|
item.isLastMessage
|
||||||
|
? `${item.thread_id}-last`
|
||||||
|
: `${item.thread_id}-${item.index ?? item.id}`
|
||||||
|
}
|
||||||
text={reasoningSegment}
|
text={reasoningSegment}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
process.env.TAURI_ENV_PLATFORM?.includes('windows') ?? 'false'
|
process.env.TAURI_ENV_PLATFORM?.includes('windows') ?? 'false'
|
||||||
),
|
),
|
||||||
IS_LINUX: JSON.stringify(
|
IS_LINUX: JSON.stringify(
|
||||||
process.env.TAURI_ENV_PLATFORM?.includes('unix') ?? 'false'
|
process.env.TAURI_ENV_PLATFORM?.includes('linux') ?? 'false'
|
||||||
),
|
),
|
||||||
IS_IOS: JSON.stringify(
|
IS_IOS: JSON.stringify(
|
||||||
process.env.TAURI_ENV_PLATFORM?.includes('ios') ?? 'false'
|
process.env.TAURI_ENV_PLATFORM?.includes('ios') ?? 'false'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user