Skip to content
Open
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
26 changes: 13 additions & 13 deletions TypeaheadAI/ClientManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ class ClientManager {
@AppStorage("freebies") var freebies: Int = 10

#if DEBUG
// private let apiUrlStreaming = URL(string: "https://typeahead-ai.fly.dev/v2/get_stream")!
// private let apiOnboarding = URL(string: "https://typeahead-ai.fly.dev/onboarding")!
// private let apiImage = URL(string: "https://typeahead-ai.fly.dev/v2/get_image")!
// private let apiIntents = URL(string: "https://typeahead-ai.fly.dev/v2/suggest_intents")!
// private let apiImageCaptions = URL(string: "https://typeahead-ai.fly.dev/v2/get_image_caption")!
// private let apiLatest = URL(string: "https://typeahead-ai.fly.dev/v2/latest")!
private let apiUrlStreaming = URL(string: "http://localhost:8080/v2/get_stream")!
private let apiOnboarding = URL(string: "http://localhost:8080/onboarding")!
private let apiImage = URL(string: "http://localhost:8080/v2/get_image")!
private let apiIntents = URL(string: "http://localhost:8080/v2/suggest_intents")!
private let apiImageCaptions = URL(string: "http://localhost:8080/v2/get_image_caption")!
private let apiLatest = URL(string: "http://localhost:8080/v2/latest")!
private let apiUrlStreaming = URL(string: "https://typeahead-ai.fly.dev/v2/get_stream")!
private let apiOnboarding = URL(string: "https://typeahead-ai.fly.dev/onboarding")!
private let apiImage = URL(string: "https://typeahead-ai.fly.dev/v2/get_image")!
private let apiIntents = URL(string: "https://typeahead-ai.fly.dev/v2/suggest_intents")!
private let apiImageCaptions = URL(string: "https://typeahead-ai.fly.dev/v2/get_image_caption")!
private let apiLatest = URL(string: "https://typeahead-ai.fly.dev/v2/latest")!
// private let apiUrlStreaming = URL(string: "http://localhost:8080/v2/get_stream")!
// private let apiOnboarding = URL(string: "http://localhost:8080/onboarding")!
// private let apiImage = URL(string: "http://localhost:8080/v2/get_image")!
// private let apiIntents = URL(string: "http://localhost:8080/v2/suggest_intents")!
// private let apiImageCaptions = URL(string: "http://localhost:8080/v2/get_image_caption")!
// private let apiLatest = URL(string: "http://localhost:8080/v2/latest")!
#else
private let apiUrlStreaming = URL(string: "https://typeahead-ai.fly.dev/v2/get_stream")!
private let apiOnboarding = URL(string: "https://typeahead-ai.fly.dev/onboarding")!
Expand Down Expand Up @@ -655,7 +655,7 @@ class ClientManager {
urlRequest.addValue("application/json", forHTTPHeaderField: "Content-Type")

guard let (data, resp) = try? await self.session.bytes(for: urlRequest) else {
let error = ClientManagerError.serverError("Could be serious... Please report to Jeff!")
let error = ClientManagerError.serverError("Couldn't connect to server... Retry or use in offline mode.")
continuation.finish(throwing: error)
return
}
Expand Down
22 changes: 11 additions & 11 deletions TypeaheadAI/ModalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ class ModalManager: ObservableObject {
self.isVisible = false
self.online = true
self.isPending = false

// Register for window moved notifications to save the new position
NotificationCenter.default.addObserver(
self,
selector: #selector(windowDidMove(_:)),
name: NSWindow.didMoveNotification, object: toastWindow)

NotificationCenter.default.addObserver(
self,
selector: #selector(windowDidResize(_:)),
name: NSWindow.didResizeNotification, object: toastWindow)
}

// TODO: Inject?
Expand Down Expand Up @@ -477,17 +488,6 @@ class ModalManager: ObservableObject {

toastWindow?.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]

// Register for window moved notifications to save the new position
NotificationCenter.default.addObserver(
self,
selector: #selector(windowDidMove(_:)),
name: NSWindow.didMoveNotification, object: toastWindow)

NotificationCenter.default.addObserver(
self,
selector: #selector(windowDidResize(_:)),
name: NSWindow.didResizeNotification, object: toastWindow)

self.isVisible = true
}

Expand Down