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

This commit is contained in:
hkfires
2025-11-22 13:09:16 +08:00
parent b05cfd9f84
commit c29931e093
2 changed files with 8 additions and 0 deletions

View File

@@ -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{}
}

View File

@@ -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{}
}