mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-23 10:00:08 +08:00
fix: regenerate message use assistant model
This commit is contained in:
parent
69ccd2aa32
commit
f642cfb3ba
@ -11,22 +11,25 @@ interface Props {
|
||||
const ErrorBlock: React.FC<Props> = ({ block }) => {
|
||||
return <MessageErrorInfo block={block} />
|
||||
}
|
||||
|
||||
const MessageErrorInfo: React.FC<{ block: ErrorMessageBlock }> = ({ block }) => {
|
||||
const { t, i18n } = useTranslation()
|
||||
|
||||
const HTTP_ERROR_CODES = [400, 401, 403, 404, 429, 500, 502, 503, 504]
|
||||
|
||||
if (block.error && HTTP_ERROR_CODES.includes(block.error?.status)) {
|
||||
return <Alert description={t(`error.http.${block.error.status}`)} message={block.error?.message} type="error" />
|
||||
}
|
||||
|
||||
if (block?.error?.message) {
|
||||
const errorKey = `error.${block.error.message}`
|
||||
const pauseErrorLanguagePlaceholder = i18n.exists(errorKey) ? t(errorKey) : block.error.message
|
||||
|
||||
return <Alert description={pauseErrorLanguagePlaceholder} type="error" />
|
||||
}
|
||||
|
||||
return <Alert description={t('error.chat.response')} type="error" />
|
||||
}
|
||||
|
||||
const Alert = styled(AntdAlert)`
|
||||
margin: 15px 0 8px;
|
||||
padding: 10px;
|
||||
|
||||
@ -136,7 +136,6 @@ const ThinkingBlock: React.FC<Props> = ({ block }) => {
|
||||
|
||||
const CollapseContainer = styled(Collapse)`
|
||||
margin-bottom: 15px;
|
||||
max-width: 960px;
|
||||
`
|
||||
|
||||
const MessageTitleLabel = styled.div`
|
||||
|
||||
@ -989,8 +989,11 @@ export const regenerateAssistantResponseThunk =
|
||||
// 5. Reset the message entity in Redux
|
||||
const resetAssistantMsg = resetAssistantMessage(messageToResetEntity, {
|
||||
status: AssistantMessageStatus.PENDING,
|
||||
updatedAt: new Date().toISOString()
|
||||
updatedAt: new Date().toISOString(),
|
||||
model: assistant.model,
|
||||
modelId: assistant?.model?.id
|
||||
})
|
||||
|
||||
dispatch(
|
||||
newMessagesActions.updateMessage({
|
||||
topicId,
|
||||
|
||||
@ -388,7 +388,7 @@ export function resetMessage(
|
||||
*/
|
||||
export const resetAssistantMessage = (
|
||||
originalMessage: Message,
|
||||
updates?: Partial<Pick<Message, 'status' | 'updatedAt'>> // Primarily allow updating status
|
||||
updates?: Partial<Pick<Message, 'status' | 'updatedAt' | 'model' | 'modelId'>> // Primarily allow updating status
|
||||
): Message => {
|
||||
// Ensure we are only resetting assistant messages
|
||||
if (originalMessage.role !== 'assistant') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user