fix: regenerate image gen

This commit is contained in:
cogwheel0
2025-08-21 16:19:21 +05:30
parent 6dedc1924c
commit ea278ee6eb
2 changed files with 11 additions and 1 deletions

View File

@@ -934,6 +934,16 @@ class _ChatPageState extends ConsumerState<ChatPage> {
}
try {
// If assistant message has generated images and it's the last message,
// use image-only regenerate flow instead of text SSE regeneration
if (message.role == 'assistant' &&
(message.files?.any((f) => f['type'] == 'image') == true) &&
messageIndex == messages.length - 1) {
final regenerateImages = ref.read(regenerateLastMessageProvider);
await regenerateImages();
return;
}
// Remove the assistant message we want to regenerate
ref.read(chatMessagesProvider.notifier).removeLastMessage();