Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

improve the ui on swift

Prateek Sunalcf01dc45bd8d
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
index e2a89d9838..35cdc92c6e 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
@@ -135,8 +135,8 @@ struct ChatView: View {
VStack(spacing: 0) {
MessageListView(
messages: viewModel.messages,
- streamingResponse: viewModel.streamingResponse,
- streamingParentId: viewModel.streamingParentId,
+ streamingResponse: viewModel.displayedStreamingResponse,
+ streamingParentId: viewModel.displayedStreamingParentId,
isGenerating: viewModel.isGenerating,
onEdit: { message in
viewModel.beginEditing(message: message)
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift
index d22867e44d..f8dec76228 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift
@@ -112,6 +112,24 @@ final class ChatViewModel: ObservableObject {
@Published var messages: [ChatMessage]
@Published var streamingResponse: String = ""
@Published var streamingParentId: UUID? = nil
+
+ var displayedStreamingResponse: String {
+ guard let activeSession = activeGenerationSessionId,
+ activeSession == currentSessionId,
+ activeGenerationId != nil else {
+ return ""
+ }
+ return streamingResponse
+ }
+
+ var displayedStreamingParentId: UUID? {
+ guard let activeSession = activeGenerationSessionId,
+ activeSession == currentSessionId,
+ activeGenerationId != nil else {
+ return nil
+ }
+ return streamingParentId
+ }
@Published var isGenerating: Bool = false
@Published var isDownloading: Bool = false
@Published var isProcessingAttachments: Bool = false
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift
index 38d82f3b2a..807e257857 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift
@@ -48,7 +48,7 @@ struct MessageListView: View {
if isGenerating, streamingParentId == message.id {
StreamingBubbleView(text: streamingResponse)
- .id("streaming")
+ .id("streaming-\(message.id.uuidString)")
}
}