Clean up, remove old stubbed stuff
This commit is contained in:
@ -21,12 +21,10 @@ public class FullScreenDigestViewModel: ObservableObject {
|
||||
if let digest = try await dataService.getLatestDigest(timeoutInterval: 10) {
|
||||
self.digest = digest
|
||||
lastVisitedDigestId = digest.id
|
||||
|
||||
if let playingDigest = audioController.itemAudioProperties as? DigestAudioItem, playingDigest.digest.id == digest.id {
|
||||
// Don't think we need to do anything here
|
||||
} else {
|
||||
audioController.play(itemAudioProperties: DigestAudioItem(digest: digest))
|
||||
audioController.pause()
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
||||
@ -127,12 +127,11 @@ struct LibraryTabView: View {
|
||||
}.tag("inbox")
|
||||
|
||||
NavigationView {
|
||||
ProfileView()
|
||||
.navigationViewStyle(.stack)
|
||||
}.tag("profile")
|
||||
}
|
||||
|
||||
ProfileView()
|
||||
.navigationViewStyle(.stack)
|
||||
}.tag("profile")
|
||||
}
|
||||
|
||||
if audioController.itemAudioProperties != nil {
|
||||
MiniPlayerViewer()
|
||||
.onTapGesture {
|
||||
|
||||
@ -29,33 +29,35 @@
|
||||
case high
|
||||
}
|
||||
|
||||
public struct DigestAudioItem: AudioItemProperties {
|
||||
public let audioItemType = Models.AudioItemType.digest
|
||||
public let digest: DigestResult
|
||||
public let itemID: String
|
||||
public let title: String
|
||||
public var byline: String?
|
||||
public var imageURL: URL?
|
||||
public var language: String?
|
||||
public var startIndex: Int = 0
|
||||
public var startOffset: Double = 0.0
|
||||
public struct DigestAudioItem: AudioItemProperties {
|
||||
public let audioItemType = Models.AudioItemType.digest
|
||||
public let digest: DigestResult
|
||||
public let itemID: String
|
||||
public let title: String
|
||||
public var byline: String?
|
||||
public var imageURL: URL?
|
||||
public var language: String?
|
||||
public var startIndex: Int = 0
|
||||
public var startOffset: Double = 0.0
|
||||
|
||||
public init(digest: DigestResult) {
|
||||
self.digest = digest
|
||||
self.itemID = digest.id
|
||||
self.title = digest.title
|
||||
self.startIndex = 0
|
||||
self.startOffset = 0
|
||||
public init(digest: DigestResult) {
|
||||
self.digest = digest
|
||||
self.itemID = digest.id
|
||||
self.title = digest.title
|
||||
self.startIndex = 0
|
||||
self.startOffset = 0
|
||||
|
||||
self.imageURL = nil
|
||||
self.imageURL = nil
|
||||
|
||||
if let first = digest.speechFiles.first {
|
||||
self.language = first.language
|
||||
self.byline = digest.byline
|
||||
}
|
||||
if let first = digest.speechFiles.first {
|
||||
self.language = first.language
|
||||
self.byline = digest.byline
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable all
|
||||
@MainActor
|
||||
public class AudioController: NSObject, ObservableObject, AVAudioPlayerDelegate {
|
||||
@Published public var state: AudioControllerState = .stopped
|
||||
@Published public var currentAudioIndex: Int = 0
|
||||
@ -1052,6 +1054,6 @@
|
||||
default: ()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -35,7 +35,7 @@ public extension DataService {
|
||||
|
||||
if let linkedItemID = linkedItemID {
|
||||
Task {
|
||||
AudioController.removeAudioFiles(itemID: linkedItemID)
|
||||
await AudioController.removeAudioFiles(itemID: linkedItemID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,7 +340,6 @@ public final class OmnivoreWebView: WKWebView {
|
||||
Task {
|
||||
let selection = try? await self.evaluateJavaScript("window.getSelection().toString()")
|
||||
if let selection = selection as? String, let explainHandler = explainHandler {
|
||||
print("Explaining \(selection)")
|
||||
explainHandler(selection)
|
||||
} else {
|
||||
showInReaderSnackbar("Error getting text to explain")
|
||||
|
||||
@ -221,12 +221,18 @@ const createUserProfile = async (
|
||||
})
|
||||
|
||||
const contextualTemplate = PromptTemplate.fromTemplate(
|
||||
digestDefinition.zeroShot.userPreferencesProfilePrompt
|
||||
`Explain the following text within the context of the provided article text
|
||||
|
||||
Text: {text}
|
||||
|
||||
Article: {content}
|
||||
`
|
||||
)
|
||||
|
||||
const chain = contextualTemplate.pipe(llm)
|
||||
const result = await chain.invoke({
|
||||
titles: preferences.map((item) => `* ${item.title}`).join('\n'),
|
||||
text: '',
|
||||
content: '',
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user