feat: 用户侧消息快捷重试功能 (#2221)
* Update MessageMenubar.tsx 用户发送消息可以重试, 方便在接口错误后进行重试 * Update MessageMenubar.tsx
This commit is contained in:
parent
8d61cbcae9
commit
f87ba144c8
@ -155,6 +155,11 @@ const MessageMenubar: FC<Props> = (props) => {
|
||||
resendMessage && onResend()
|
||||
}, [message, onEditMessage, onResend, t])
|
||||
|
||||
const onResend = useCallback(async () => {
|
||||
await onEditMessage?.({ ...message, content: message.content })
|
||||
onResend && onResend()
|
||||
}, [message, onEditMessage, onResend])
|
||||
|
||||
const handleTranslate = useCallback(
|
||||
async (language: string) => {
|
||||
if (isTranslating) return
|
||||
@ -293,6 +298,13 @@ const MessageMenubar: FC<Props> = (props) => {
|
||||
|
||||
return (
|
||||
<MenusBar className={`menubar ${isLastMessage && 'show'}`}>
|
||||
{message.role === 'user' && (
|
||||
<Tooltip title={t('common.regenerate')} mouseEnterDelay={0.8}>
|
||||
<ActionButton className="message-action-button" onClick={onResend}>
|
||||
<SyncOutlined />
|
||||
</ActionButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
{message.role === 'user' && (
|
||||
<Tooltip title={t('common.edit')} mouseEnterDelay={0.8}>
|
||||
<ActionButton className="message-action-button" onClick={onEdit}>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user