Skip to content

Commit bf2757b

Browse files
committed
update
1 parent a5e4a49 commit bf2757b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

.DS_Store

6 KB
Binary file not shown.

Sources/openai-async-image-swiftui/model/Input.swift

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Foundation
99

1010

1111
/// Input format to OpenAI API
12+
/// Given a prompt and/or an input image, the model will generate a new image
1213
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
1314
struct Input: Encodable{
1415

@@ -20,4 +21,7 @@ struct Input: Encodable{
2021

2122
/// The format in which the generated images are returned. Must be one of url or b64_json
2223
let response_format : ResponseFormat
24+
25+
/// The number of images to generate
26+
let n : Int
2327
}

Sources/openai-async-image-swiftui/viewModel/OpenAIDefaultLoader.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public final class OpenAIDefaultLoader : IOpenAILoader{
3737

3838
client = Http.Proxy(baseURL: url)
3939
}
40-
40+
4141
/// Load image by text
4242
/// - Parameters:
4343
/// - prompt: Text
@@ -48,7 +48,7 @@ public final class OpenAIDefaultLoader : IOpenAILoader{
4848
with size : OpenAIImageSize
4949
) async throws -> Image{
5050

51-
let body = Input(prompt: prompt, size: size, response_format: .b64)
51+
let body = Input(prompt: prompt, size: size, response_format: .b64, n: 1)
5252

5353
let headers = ["Authorization": "Bearer \(endpoint.apiKey)"]
5454
let path = endpoint.path

0 commit comments

Comments
 (0)