fix(translator): ignore empty JSON chunks in OpenAI responses

This commit is contained in:
hkfires committed 2025-11-22 13:09:16 +08:00
1 parent b05cfd9f84
commit c29931e093
2 files changed
+8

No files matched your search

@@ -45,6 +45,10 @@ func ConvertAntigravityResponseToOpenAI(_ context.Context, _ string, originalReq
}
}
if len(bytes.TrimSpace(rawJSON)) == 0 {
return []string{}
}
if bytes.Equal(rawJSON, []byte("[DONE]")) {
return []string{}
}
@@ -45,6 +45,10 @@ func ConvertCliResponseToOpenAI(_ context.Context, _ string, originalRequestRawJ
}
}
if len(bytes.TrimSpace(rawJSON)) == 0 {
return []string{}
}
if bytes.Equal(rawJSON, []byte("[DONE]")) {
return []string{}
}