- Copy complete source code packages from original CodeNomad project - Add root package.json with npm workspace configuration - Include electron-app, server, ui, tauri-app, and opencode-config packages - Fix Launch-Windows.bat and Launch-Dev-Windows.bat to work with correct npm scripts - Fix Launch-Unix.sh to work with correct npm scripts - Launchers now correctly call npm run dev:electron which launches Electron app
65 lines
2.2 KiB
TypeScript
65 lines
2.2 KiB
TypeScript
import { Index, type Accessor } from "solid-js"
|
|
import VirtualItem from "./virtual-item"
|
|
import MessageBlock from "./message-block"
|
|
import type { InstanceMessageStore } from "../stores/message-v2/instance-store"
|
|
|
|
export function getMessageAnchorId(messageId: string) {
|
|
return `message-anchor-${messageId}`
|
|
}
|
|
|
|
const VIRTUAL_ITEM_MARGIN_PX = 800
|
|
|
|
interface MessageBlockListProps {
|
|
instanceId: string
|
|
sessionId: string
|
|
store: () => InstanceMessageStore
|
|
messageIds: () => string[]
|
|
lastAssistantIndex: () => number
|
|
showThinking: () => boolean
|
|
thinkingDefaultExpanded: () => boolean
|
|
showUsageMetrics: () => boolean
|
|
scrollContainer: Accessor<HTMLDivElement | undefined>
|
|
loading?: boolean
|
|
onRevert?: (messageId: string) => void
|
|
onFork?: (messageId?: string) => void
|
|
onContentRendered?: () => void
|
|
setBottomSentinel: (element: HTMLDivElement | null) => void
|
|
suspendMeasurements?: () => boolean
|
|
}
|
|
|
|
export default function MessageBlockList(props: MessageBlockListProps) {
|
|
return (
|
|
<>
|
|
<Index each={props.messageIds()}>
|
|
{(messageId, index) => (
|
|
<VirtualItem
|
|
id={getMessageAnchorId(messageId())}
|
|
cacheKey={messageId()}
|
|
scrollContainer={props.scrollContainer}
|
|
threshold={VIRTUAL_ITEM_MARGIN_PX}
|
|
placeholderClass="message-stream-placeholder"
|
|
virtualizationEnabled={() => !props.loading}
|
|
suspendMeasurements={props.suspendMeasurements}
|
|
>
|
|
<MessageBlock
|
|
messageId={messageId()}
|
|
instanceId={props.instanceId}
|
|
sessionId={props.sessionId}
|
|
store={props.store}
|
|
messageIndex={index}
|
|
lastAssistantIndex={props.lastAssistantIndex}
|
|
showThinking={props.showThinking}
|
|
thinkingDefaultExpanded={props.thinkingDefaultExpanded}
|
|
showUsageMetrics={props.showUsageMetrics}
|
|
onRevert={props.onRevert}
|
|
onFork={props.onFork}
|
|
onContentRendered={props.onContentRendered}
|
|
/>
|
|
</VirtualItem>
|
|
)}
|
|
</Index>
|
|
<div ref={props.setBottomSentinel} aria-hidden="true" style={{ height: "1px" }} />
|
|
</>
|
|
)
|
|
}
|