fix(ChatNavigation): Add unique keys to navigation info messages
This commit is contained in:
parent
a090984c67
commit
c0e85b6caf
@ -91,20 +91,20 @@ const ChatNavigation: FC<ChatNavigationProps> = ({ containerId }) => {
|
|||||||
const userMessages = findUserMessages()
|
const userMessages = findUserMessages()
|
||||||
const assistantMessages = findAssistantMessages()
|
const assistantMessages = findAssistantMessages()
|
||||||
if (userMessages.length === 0 && assistantMessages.length === 0) {
|
if (userMessages.length === 0 && assistantMessages.length === 0) {
|
||||||
message.info(t('chat.navigation.last'))
|
message.info({ content: t('chat.navigation.last'), key: 'navigation-last' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const visibleIndex = getCurrentVisibleIndex('down')
|
const visibleIndex = getCurrentVisibleIndex('down')
|
||||||
if (visibleIndex === -1) {
|
if (visibleIndex === -1) {
|
||||||
message.info(t('chat.navigation.last'))
|
message.info({ content: t('chat.navigation.last'), key: 'navigation-last' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetIndex = visibleIndex - 1
|
const targetIndex = visibleIndex - 1
|
||||||
|
|
||||||
if (targetIndex < 0) {
|
if (targetIndex < 0) {
|
||||||
message.info(t('chat.navigation.last'))
|
message.info({ content: t('chat.navigation.last'), key: 'navigation-last' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,20 +116,20 @@ const ChatNavigation: FC<ChatNavigationProps> = ({ containerId }) => {
|
|||||||
const userMessages = findUserMessages()
|
const userMessages = findUserMessages()
|
||||||
const assistantMessages = findAssistantMessages()
|
const assistantMessages = findAssistantMessages()
|
||||||
if (userMessages.length === 0 && assistantMessages.length === 0) {
|
if (userMessages.length === 0 && assistantMessages.length === 0) {
|
||||||
message.info(t('chat.navigation.first'))
|
message.info({ content: t('chat.navigation.first'), key: 'navigation-first' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const visibleIndex = getCurrentVisibleIndex('up')
|
const visibleIndex = getCurrentVisibleIndex('up')
|
||||||
if (visibleIndex === -1) {
|
if (visibleIndex === -1) {
|
||||||
message.info(t('chat.navigation.first'))
|
message.info({ content: t('chat.navigation.first'), key: 'navigation-first' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetIndex = visibleIndex + 1
|
const targetIndex = visibleIndex + 1
|
||||||
|
|
||||||
if (targetIndex >= userMessages.length) {
|
if (targetIndex >= userMessages.length) {
|
||||||
message.info(t('chat.navigation.first'))
|
message.info({ content: t('chat.navigation.first'), key: 'navigation-first' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user