Log Seedream payload shape before forwarding to the gateway
Seedream image jobs now log whether image input was present, whether it was sent as a single string or an array, how many references were included, and which size preset was used. This makes it possible to prove whether missing reference images are a server bug or a downstream gateway issue. Constraint: The test server needed a low-noise way to confirm what reached /v1/images/generations without changing the external API contract Rejected: Rely on gateway-side observation alone | it could not distinguish whether the image array was dropped before or after the server boundary Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep this Seedream request-shape log until the gateway team has finished validating image-array forwarding end to end Tested: go test ./internal/server Tested: Seedream 4.5 job on test server with three image refs after deploying binary (job_47513ead2708) Not-tested: Long-term log volume impact under sustained Seedream traffic
This commit is contained in:
@@ -615,6 +615,14 @@ func (c *newAPIClient) generateSeedreamImageRefs(ctx context.Context, token, mod
|
||||
}
|
||||
payload["image"] = imageInput
|
||||
}
|
||||
log.Printf(
|
||||
"popiartServer: Seedream image request model=%s has_image=%t image_type=%s image_count=%d size=%v",
|
||||
modelID,
|
||||
payload["image"] != nil,
|
||||
describeImagePayloadType(payload["image"]),
|
||||
countImagePayloadItems(payload["image"]),
|
||||
payload["size"],
|
||||
)
|
||||
|
||||
body, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
@@ -1340,6 +1348,39 @@ func encodeSeedreamReferenceInputs(refs []imageEditReference) (any, error) {
|
||||
return encodeImageReferenceInputs(refs)
|
||||
}
|
||||
|
||||
func describeImagePayloadType(value any) string {
|
||||
switch value.(type) {
|
||||
case nil:
|
||||
return "missing"
|
||||
case string:
|
||||
return "string"
|
||||
case []string:
|
||||
return "string_array"
|
||||
case []any:
|
||||
return "array"
|
||||
default:
|
||||
return fmt.Sprintf("%T", value)
|
||||
}
|
||||
}
|
||||
|
||||
func countImagePayloadItems(value any) int {
|
||||
switch typed := value.(type) {
|
||||
case nil:
|
||||
return 0
|
||||
case string:
|
||||
if strings.TrimSpace(typed) == "" {
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
case []string:
|
||||
return len(typed)
|
||||
case []any:
|
||||
return len(typed)
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
func encodeImageReference(ref imageEditReference) (string, error) {
|
||||
if rawURL := strings.TrimSpace(ref.URL); rawURL != "" {
|
||||
return rawURL, nil
|
||||
|
||||
Reference in New Issue
Block a user