fix test
This commit is contained in:
parent
207c057304
commit
b2825ac1f6
@ -100,6 +100,9 @@ const FLOW_HISTORY_FRAMES = [
|
|||||||
{ id: 'history-3', widths: ['70%', '52%'] },
|
{ id: 'history-3', widths: ['70%', '52%'] },
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
|
const createFlowHistoryFrames = () =>
|
||||||
|
Array.from(FLOW_HISTORY_FRAMES, (frame) => ({ ...frame }))
|
||||||
|
|
||||||
const FLOW_TYPING_TEXT = 'Jan, help me summarize this'
|
const FLOW_TYPING_TEXT = 'Jan, help me summarize this'
|
||||||
// Mirror Flow's history reveal timing so the typing cadence stays aligned.
|
// Mirror Flow's history reveal timing so the typing cadence stays aligned.
|
||||||
const STICKY_USER_MESSAGE_DELAY =
|
const STICKY_USER_MESSAGE_DELAY =
|
||||||
@ -114,7 +117,7 @@ function FlowScrollPreview({ placeholder }: { placeholder: string }) {
|
|||||||
const [streamProgress, setStreamProgress] = useState(0)
|
const [streamProgress, setStreamProgress] = useState(0)
|
||||||
const [historyMessages, setHistoryMessages] = useState<
|
const [historyMessages, setHistoryMessages] = useState<
|
||||||
Array<{ id: string; widths: readonly string[] }>
|
Array<{ id: string; widths: readonly string[] }>
|
||||||
>(FLOW_HISTORY_FRAMES)
|
>(createFlowHistoryFrames)
|
||||||
const [exitingHistoryIds, setExitingHistoryIds] = useState<string[]>([])
|
const [exitingHistoryIds, setExitingHistoryIds] = useState<string[]>([])
|
||||||
const [userMessageVisible, setUserMessageVisible] = useState(false)
|
const [userMessageVisible, setUserMessageVisible] = useState(false)
|
||||||
const [streamStage, setStreamStage] = useState<'idle' | 'streaming' | 'complete'>('idle')
|
const [streamStage, setStreamStage] = useState<'idle' | 'streaming' | 'complete'>('idle')
|
||||||
@ -138,7 +141,7 @@ function FlowScrollPreview({ placeholder }: { placeholder: string }) {
|
|||||||
timersRef.current = []
|
timersRef.current = []
|
||||||
|
|
||||||
if (step === 0) {
|
if (step === 0) {
|
||||||
setHistoryMessages(FLOW_HISTORY_FRAMES)
|
setHistoryMessages(createFlowHistoryFrames())
|
||||||
setExitingHistoryIds([])
|
setExitingHistoryIds([])
|
||||||
setTypedText('')
|
setTypedText('')
|
||||||
setSentMessage('')
|
setSentMessage('')
|
||||||
@ -305,7 +308,13 @@ function StickyScrollPreview({ placeholder }: { placeholder: string }) {
|
|||||||
const [typedText, setTypedText] = useState('')
|
const [typedText, setTypedText] = useState('')
|
||||||
const [messages, setMessages] = useState<
|
const [messages, setMessages] = useState<
|
||||||
Array<{ id: string; type: 'assistant' | 'user'; widths: readonly string[] }>
|
Array<{ id: string; type: 'assistant' | 'user'; widths: readonly string[] }>
|
||||||
>(FLOW_HISTORY_FRAMES.map((frame) => ({ ...frame, type: 'assistant' })))
|
>(
|
||||||
|
() =>
|
||||||
|
createFlowHistoryFrames().map((frame) => ({
|
||||||
|
...frame,
|
||||||
|
type: 'assistant' as const,
|
||||||
|
}))
|
||||||
|
)
|
||||||
const [exitingIds, setExitingIds] = useState<string[]>([])
|
const [exitingIds, setExitingIds] = useState<string[]>([])
|
||||||
const exitingIdsRef = useRef(exitingIds)
|
const exitingIdsRef = useRef(exitingIds)
|
||||||
const timersRef = useRef<number[]>([])
|
const timersRef = useRef<number[]>([])
|
||||||
@ -321,7 +330,7 @@ function StickyScrollPreview({ placeholder }: { placeholder: string }) {
|
|||||||
|
|
||||||
if (step === 0) {
|
if (step === 0) {
|
||||||
setMessages(
|
setMessages(
|
||||||
FLOW_HISTORY_FRAMES.map((frame) => ({
|
createFlowHistoryFrames().map((frame) => ({
|
||||||
...frame,
|
...frame,
|
||||||
type: 'assistant' as const,
|
type: 'assistant' as const,
|
||||||
}))
|
}))
|
||||||
|
|||||||
@ -224,16 +224,21 @@ const validatePersistedSnapshot = (value: string): string | null => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parsed && typeof parsed === 'object' && parsed.state) {
|
if (parsed && typeof parsed === 'object' && parsed.state) {
|
||||||
const draft = { ...parsed }
|
const state = parsed.state
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!isThreadScrollBehavior(
|
!isThreadScrollBehavior(
|
||||||
draft.state.threadScrollBehavior as ThreadScrollBehavior
|
state.threadScrollBehavior as ThreadScrollBehavior
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
draft.state = {
|
const draft = {
|
||||||
...draft.state,
|
...parsed,
|
||||||
threadScrollBehavior: DEFAULT_THREAD_SCROLL_BEHAVIOR,
|
state: {
|
||||||
|
...state,
|
||||||
|
threadScrollBehavior: DEFAULT_THREAD_SCROLL_BEHAVIOR,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSON.stringify(draft)
|
return JSON.stringify(draft)
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user