-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from SunburstEnzo/demoapp_moderations
Add Moderations chat example to Demo app
- Loading branch information
Showing
4 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// ModerationChatView.swift | ||
// DemoChat | ||
// | ||
// Created by Aled Samuel on 26/04/2023. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct ModerationChatView: View { | ||
@ObservedObject var store: MiscStore | ||
|
||
@Environment(\.dateProviderValue) var dateProvider | ||
@Environment(\.idProviderValue) var idProvider | ||
|
||
public init(store: MiscStore) { | ||
self.store = store | ||
} | ||
|
||
public var body: some View { | ||
DetailView( | ||
conversation: store.moderationConversation, | ||
error: store.moderationConversationError, | ||
sendMessage: { message in | ||
Task { | ||
await store.sendModerationMessage( | ||
Message( | ||
id: idProvider(), | ||
role: .user, | ||
content: message, | ||
createdAt: dateProvider() | ||
) | ||
) | ||
} | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters