Skip to content

Commit

Permalink
Updating demos
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrochabrun committed Nov 10, 2023
1 parent 6ce24d7 commit b2d8076
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,14 @@ struct ChatDemoView: View {
Task {
isLoading = true
defer { isLoading = false } // ensure isLoading is set to false when the
let parameters = ChatCompletionParameters(messages: [.init(
role: .user,
content: .text(prompt))], model: .gpt41106Preview)
switch selectedSegment {
case .chatCompletion:
try await chatProvider.startChat(parameters: .init(messages: [
.init(role: .user, content: .contentArray([
.text(prompt), .imageUrl(URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")!)
]))
], model: .gpt4VisionPreview))
try await chatProvider.startChat(parameters: parameters)
case .chatCompeltionStream:
try await chatProvider
.startStreamedChat(
parameters: .init(messages: [.init(
role: .user,
content: .contentArray([
.text(prompt), .imageUrl(URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")!)
]))],
model: .gpt4VisionPreview))
try await chatProvider.startStreamedChat(parameters: parameters)
}
}
} label: {
Expand Down

0 comments on commit b2d8076

Please sign in to comment.