feat: Select derived messages from backend #2088 (#2176)

### What problem does this PR solve?

feat: Select derived messages from backend #2088

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-30 17:53:30 +08:00
committed by GitHub
parent 2c771fb0b4
commit 5400467da1
13 changed files with 556 additions and 220 deletions

View File

@ -91,7 +91,7 @@ export const AssistantGroupButton = ({
interface UserGroupButtonProps extends Partial<IRemoveMessageById> {
messageId: string;
content: string;
regenerateMessage(): void;
regenerateMessage?: () => void;
sendLoading: boolean;
}
@ -113,15 +113,17 @@ export const UserGroupButton = ({
<Radio.Button value="a">
<CopyToClipboard text={content}></CopyToClipboard>
</Radio.Button>
<Radio.Button
value="b"
onClick={regenerateMessage}
disabled={sendLoading}
>
<Tooltip title={t('chat.regenerate')}>
<SyncOutlined spin={sendLoading} />
</Tooltip>
</Radio.Button>
{regenerateMessage && (
<Radio.Button
value="b"
onClick={regenerateMessage}
disabled={sendLoading}
>
<Tooltip title={t('chat.regenerate')}>
<SyncOutlined spin={sendLoading} />
</Tooltip>
</Radio.Button>
)}
{removeMessageById && (
<Radio.Button value="c" onClick={onRemoveMessage} disabled={loading}>
<Tooltip title={t('common.delete')}>

View File

@ -79,7 +79,7 @@ const MessageItem = ({
);
const handleRegenerateMessage = useCallback(() => {
regenerateMessage(item);
regenerateMessage?.(item);
}, [regenerateMessage, item]);
useEffect(() => {
@ -138,7 +138,9 @@ const MessageItem = ({
content={item.content}
messageId={item.id}
removeMessageById={removeMessageById}
regenerateMessage={handleRegenerateMessage}
regenerateMessage={
regenerateMessage && handleRegenerateMessage
}
sendLoading={sendLoading}
></UserGroupButton>
)}