Merge pull request #315 from cogwheel0/fix-streaming-follow-ups
fix(streaming): sync follow-ups to server after generation
This commit is contained in:
@@ -1060,6 +1060,30 @@ ActiveSocketStream attachUnifiedChunkedStreaming({
|
|||||||
'Follow-ups set successfully',
|
'Follow-ups set successfully',
|
||||||
scope: 'streaming/helper',
|
scope: 'streaming/helper',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Sync to server to persist follow-ups (they arrive after done:true)
|
||||||
|
final chatId = activeConversationId;
|
||||||
|
if (chatId != null && chatId.isNotEmpty && suggestions.isNotEmpty) {
|
||||||
|
Future.microtask(() async {
|
||||||
|
try {
|
||||||
|
final currentMessages = getMessages();
|
||||||
|
await api.syncConversationMessages(
|
||||||
|
chatId,
|
||||||
|
currentMessages,
|
||||||
|
model: modelId,
|
||||||
|
);
|
||||||
|
DebugLogger.log(
|
||||||
|
'Follow-ups persisted to server',
|
||||||
|
scope: 'streaming/helper',
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
DebugLogger.log(
|
||||||
|
'Failed to persist follow-ups: $e',
|
||||||
|
scope: 'streaming/helper',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DebugLogger.log(
|
DebugLogger.log(
|
||||||
'Follow-ups: targetId is null',
|
'Follow-ups: targetId is null',
|
||||||
|
|||||||
Reference in New Issue
Block a user