Skip to content

Commit adabce1

Browse files
committed
No more transparent bg param option
1 parent aa2cf44 commit adabce1

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

.ENV.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GENERATED_IMAGES_BUCKET=your-generated-images-bucket
88
OPENAI_API_KEY=your-openai-api-key
99
AWS_ACCESS_KEY_ID=your-aws-access-key-id
1010
AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key
11-
OPENAI_IMAGE_MODEL=gpt-image-1.5
11+
OPENAI_IMAGE_MODEL=gpt-image-2
1212
IMAGE_GEN_PREFIX=generated/v2
1313

1414
BACKEND_HOST=127.0.0.1

Backend/Sources/Server/Model/ImageGenRequest.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
struct ImageGenRequest: Encodable {
2-
let background: String
32
let model: String
43
let outputFormat: String
54
let prompt: String
65
let quality: String
76
let size: String
87

98
enum CodingKeys: String, CodingKey {
10-
case background
119
case model
1210
case outputFormat = "output_format"
1311
case prompt

Backend/Sources/Server/OpenAiClient.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ struct OpenAiClient {
2121

2222
func generateImage(prompt: String) async throws -> Data {
2323
let payload = ImageGenRequest(
24-
background: "transparent",
2524
model: environment.openAIModel,
2625
outputFormat: "png",
2726
prompt: prompt,

Backend/Tests/CoreTests/EnvironmentTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct EnvironmentTests {
1111
"HOST": "127.0.0.1",
1212
"IMAGE_GEN_PREFIX": "/generated/v2/",
1313
"OPENAI_API_KEY": "secret",
14-
"OPENAI_IMAGE_MODEL": "gpt-image-1.5",
14+
"OPENAI_IMAGE_MODEL": "gpt-image-2",
1515
"PORT": "8080",
1616
]
1717
)
@@ -21,7 +21,7 @@ struct EnvironmentTests {
2121
#expect(environment.generatedImagesPrefix == "generated/v2")
2222
#expect(environment.hostname == "127.0.0.1")
2323
#expect(environment.openAIAPIKey == "secret")
24-
#expect(environment.openAIModel == "gpt-image-1.5")
24+
#expect(environment.openAIModel == "gpt-image-2")
2525
#expect(environment.port == 8080)
2626
}
2727

@@ -34,7 +34,7 @@ struct EnvironmentTests {
3434
"GENERATED_IMAGES_BUCKET": "bytesized-generated-images",
3535
"IMAGE_GEN_PREFIX": "generated/v2",
3636
"OPENAI_API_KEY": "secret",
37-
"OPENAI_IMAGE_MODEL": "gpt-image-1.5",
37+
"OPENAI_IMAGE_MODEL": "gpt-image-2",
3838
]
3939
)
4040

@@ -50,7 +50,7 @@ struct EnvironmentTests {
5050
"GENERATED_IMAGES_BUCKET": "bytesized-generated-images",
5151
"IMAGE_GEN_PREFIX": "generated/v2",
5252
"OPENAI_API_KEY": "secret",
53-
"OPENAI_IMAGE_MODEL": "gpt-image-1.5",
53+
"OPENAI_IMAGE_MODEL": "gpt-image-2",
5454
"PORT": "8080",
5555
]
5656
)
@@ -67,7 +67,7 @@ struct EnvironmentTests {
6767
"GENERATED_IMAGES_BUCKET": "bytesized-generated-images",
6868
"IMAGE_GEN_PREFIX": "generated/v2",
6969
"OPENAI_API_KEY": "secret",
70-
"OPENAI_IMAGE_MODEL": "gpt-image-1.5",
70+
"OPENAI_IMAGE_MODEL": "gpt-image-2",
7171
]
7272
)
7373
}

SPEC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Implement a web app where:
1010
- When the daily generation budget is exhausted, the backend returns a random previously generated image instead of requesting a new one.
1111
- The backend waits for image generation to finish before replying.
1212
- The final image is rendered from a public S3 HTTPS URL.
13-
- The image is generated by the OpenAI image generation API using the fixed model `gpt-image-1.5`.
13+
- The image is generated by the OpenAI image generation API using the fixed model `gpt-image-2`.
1414
- The generation prompt should use the request's origin country when the server can resolve it from the client IP through `country.is`, and otherwise fall back to a generic worldwide prompt.
1515
- The backend performs `country.is` lookups and OpenAI image-generation requests with AsyncHTTPClient.
1616
- The backend uses a long-lived Hummingbird server.
@@ -148,7 +148,7 @@ Rules:
148148
- Instruct the model to show exactly one hero food item with no combo meals, side dishes, drinks, menus, flags, labels, or text.
149149
- Instruct the model to avoid defaulting to globally common fast food such as hamburgers, fries, pizza, or hot dogs unless the subject is a distinctive named local variation.
150150
- Fall back to the same prompt structure scoped to somewhere in the world when the client IP or country cannot be resolved.
151-
- Call the OpenAI image generation API with model `gpt-image-1.5`.
151+
- Call the OpenAI image generation API with model `gpt-image-2`, PNG output.
152152
- Upload the PNG to the generated image key used for the dated generation pool.
153153
- Upload the same PNG to the daily page-cache key.
154154
- Return the page-cache `url`.

0 commit comments

Comments
 (0)