improve message autoscroll and metadata
This commit is contained in:
@@ -270,6 +270,8 @@ export default function MessageStream(props: MessageStreamProps) {
|
||||
)
|
||||
})
|
||||
|
||||
const currentSession = createMemo(() => sessions().get(props.instanceId)?.get(props.sessionId))
|
||||
|
||||
const formattedSessionInfo = createMemo(() => {
|
||||
const sessionInfo = getSessionInfo(props.instanceId, props.sessionId) || {
|
||||
tokens: 0,
|
||||
@@ -287,6 +289,7 @@ export default function MessageStream(props: MessageStreamProps) {
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
function isNearBottom(element: HTMLDivElement, offset = SCROLL_OFFSET) {
|
||||
const { scrollTop, scrollHeight, clientHeight } = element
|
||||
const distance = scrollHeight - (scrollTop + clientHeight)
|
||||
@@ -388,7 +391,14 @@ export default function MessageStream(props: MessageStreamProps) {
|
||||
|
||||
tokenSegments.push(`${message.id}:${message.version ?? 0}:${message.status}:${message.parts.length}`)
|
||||
|
||||
for (const part of message.parts) {
|
||||
const partId = typeof part.id === "string" ? part.id : part.type ?? "part"
|
||||
const partVersion = typeof (part as any).version === "number" ? (part as any).version : 0
|
||||
tokenSegments.push(`${message.id}:${partId}:${partVersion}`)
|
||||
}
|
||||
|
||||
const baseDisplayParts = message.displayParts
|
||||
|
||||
const displayParts: MessageDisplayParts =
|
||||
baseDisplayParts && baseDisplayParts.showThinking === showThinking
|
||||
? baseDisplayParts
|
||||
|
||||
Reference in New Issue
Block a user