feat: done create new doc

This commit is contained in:
Lakr
2025-04-04 16:22:50 +08:00
committed by LongYinan
parent a7db5c5027
commit 486e047b6d
6 changed files with 74 additions and 8 deletions
@@ -0,0 +1,16 @@
//
// File.swift
// Intelligents
//
// Created by on 4/4/25.
//
import Foundation
public extension Intelligents {
enum Delegates {
public static var createNewDocument: ((_ title: String, _ content: String) -> Void) = { _, _ in }
public static var dismissAll: (() -> Void) = { }
}
}
@@ -131,6 +131,10 @@ public class IntelligentsEphemeralActionController: UIViewController {
guard let self else { return }
continueToChat()
}
actionBar.createNewDoc.action = { [weak self] in
guard let self else { return }
createNewDoc()
}
}
func setupContentViews() {
@@ -294,4 +298,10 @@ extension IntelligentsEphemeralActionController {
chatController.metadata[.content] = documentContent
navigationController?.pushViewController(chatController, animated: true)
}
func createNewDoc() {
let content = copilotDocumentStorage
Intelligents.Delegates.createNewDocument("New Document", content)
Intelligents.Delegates.dismissAll()
}
}