Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.46 KB

README.md

File metadata and controls

55 lines (42 loc) · 1.46 KB

DelightAI-iOS

Installation ⚙️

Add a package dependency

In your Xcode project, select File > Add Package Dependency and enter this repository URL: https://github.com/HungryFoolishHappy/DelightAI-iOS.git .

Demo 🎥

Delight.demo.video.mp4

Usage Example 📚

Import and init the framework in your project:

import DelightAI
let delightAI = DelightAI()

Call the sendChat function to send user text/prompt, then wait for agent response. Here is the async/await version.

do {
    let result = try await delight.sendChat(text: "Hello", // text to DelightAI, usually user’s message or prompt
                                        webhookId: "6b86705a-8b32-48d2-b176-ba518bb3d1e0", // our demo webhook id, or your agent’s actual webhook id from https://delight.global
                                        userId: "Wi-iOS-9937-491d-aefd-xxxxx",
                                        username: "Wi-iOS-9937-491d-aefd-xxxxx")
    // use result
} catch {
    // ...
}

Also supports the completion handler variant.

do {
    delight.sendChat(text: text, 
                     webhookId: webhookId,
                     userId: userId,
                     username: username) { result in
        switch result {
        case.success(let success):
            print(success)
        case .failure(let failure):
            print(failure)
        }
    }
} catch {
    // ...
}