Let File > Export as HTML/PDF/Markdown choose name and location
Previously always silently wrote to Downloads with a fixed name — no way to pick where it goes or rename it. Added exportConversationWithSavePanel(format:defaultFilename:), which shows a native NSSavePanel (defaulting to Downloads + the same filename as before) before writing. Wired into all three File menu export buttons. The /export slash command and the conversation list's per-row Export submenu are unchanged (still write straight to Downloads) — the slash command already takes an explicit filename argument inline, and the row export is meant as a quick one-click action rather than a save-as workflow.
This commit is contained in:
+3
-3
@@ -121,21 +121,21 @@ struct oAIApp: App {
|
||||
Button("Export as Markdown…") {
|
||||
let name = chatViewModel.currentConversationName ?? "conversation"
|
||||
let safe = name.components(separatedBy: .whitespacesAndNewlines).joined(separator: "-")
|
||||
chatViewModel.exportConversation(format: "md", filename: "\(safe).md")
|
||||
chatViewModel.exportConversationWithSavePanel(format: "md", defaultFilename: "\(safe).md")
|
||||
}
|
||||
.disabled(chatViewModel.messages.filter { $0.role != .system }.isEmpty)
|
||||
|
||||
Button("Export as HTML…") {
|
||||
let name = chatViewModel.currentConversationName ?? "conversation"
|
||||
let safe = name.components(separatedBy: .whitespacesAndNewlines).joined(separator: "-")
|
||||
chatViewModel.exportConversation(format: "html", filename: "\(safe).html")
|
||||
chatViewModel.exportConversationWithSavePanel(format: "html", defaultFilename: "\(safe).html")
|
||||
}
|
||||
.disabled(chatViewModel.messages.filter { $0.role != .system }.isEmpty)
|
||||
|
||||
Button("Export as PDF…") {
|
||||
let name = chatViewModel.currentConversationName ?? "conversation"
|
||||
let safe = name.components(separatedBy: .whitespacesAndNewlines).joined(separator: "-")
|
||||
chatViewModel.exportConversation(format: "pdf", filename: "\(safe).pdf")
|
||||
chatViewModel.exportConversationWithSavePanel(format: "pdf", defaultFilename: "\(safe).pdf")
|
||||
}
|
||||
.disabled(chatViewModel.messages.filter { $0.role != .system }.isEmpty)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user