Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre report fixes #127

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OLMoE.swift/Styles/ButtonStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct PrimaryButton: ButtonStyle {
.padding(.horizontal, 12)
.background(Color.accentColor)
.cornerRadius(12)
.font(.manrope(size: 14))
.font(.body())
.fontWeight(.semibold)
.foregroundColor(Color("TextColorButton"))
}
Expand All @@ -39,7 +39,7 @@ struct SecondaryButton: ButtonStyle {
.padding(.horizontal, 12)
.background(Color.background)
.cornerRadius(12)
.font(.manrope(size: 14))
.font(.body())
.fontWeight(.semibold)
.foregroundColor(Color("AccentColor"))
.preferredColorScheme(.dark)
Expand Down
4 changes: 2 additions & 2 deletions OLMoE.swift/Styles/Typography.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ extension Font {
}

static func body() -> Font {
.manrope(.medium, size: 14)
.manrope(.medium, size: 17)
}

static func subheader() -> Font {
.manrope(.medium, size: 18)
.manrope(.medium, size: 20)
}
}
2 changes: 1 addition & 1 deletion OLMoE.swift/Views/MessageInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct MessageInputView: View {
}
.font(.system(size: 24))
.frame(width: 40, height: 40)
.padding(.top, 2)
.padding(.top, 4)
.padding(.trailing, 4)

}
Expand Down
7 changes: 7 additions & 0 deletions OLMoE.swift/Views/ModelDownloadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class BackgroundDownloadManager: NSObject, ObservableObject, URLSessionDownloadD
private var lastUpdateTime: Date = Date()
private var hasCheckedDiskSpace = false
private let updateInterval: TimeInterval = 0.5 // Update UI every 0.5 seconds
private var lastDispatchedBytesWritten: Int64 = 0

private override init() {
super.init()
Expand All @@ -41,6 +42,8 @@ class BackgroundDownloadManager: NSObject, ObservableObject, URLSessionDownloadD
if path.status == .unsatisfied {
self.downloadError = "Connection lost. Please check your internet connection."
self.isDownloading = false
self.hasCheckedDiskSpace = false
self.isModelReady = false
self.downloadTask?.cancel()
}
}
Expand Down Expand Up @@ -113,6 +116,10 @@ class BackgroundDownloadManager: NSObject, ObservableObject, URLSessionDownloadD
let currentTime = Date()
if currentTime.timeIntervalSince(lastUpdateTime) >= updateInterval {
DispatchQueue.main.async {
// Due to async nature, older updates might run later; update progress only if data is more recent.
guard totalBytesWritten > self.lastDispatchedBytesWritten else { return }
self.lastDispatchedBytesWritten = totalBytesWritten

self.downloadProgress = Float(totalBytesWritten) / Float(totalBytesExpectedToWrite)
self.downloadedSize = totalBytesWritten
self.totalSize = totalBytesExpectedToWrite
Expand Down