]> git.99rst.org Git - sgasser-llm-shield.git/commitdiff
Added fix for receiving metadata (usage etc.) in API streaming mode - some providers...
authorElad Kapusta <redacted>
Mon, 22 Jun 2026 17:44:39 +0000 (20:44 +0300)
committerElad Kapusta <redacted>
Mon, 22 Jun 2026 17:44:39 +0000 (20:44 +0300)
src/providers/openai/stream-transformer.ts

index c382ddc57734106109ab76a3024df5e56d51dce7..c0c6a817a9f08e8b6be90ea9b02c91a160cb8973 100644 (file)
@@ -120,7 +120,7 @@ export function createUnmaskingStream(
                 const parsed = JSON.parse(data);
                 const content = parsed.choices?.[0]?.delta?.content;
 
-                if (typeof content === "string") {
+                if (typeof content === "string" && content !== "") {
                   const unmasked = unmaskTextContent(
                     content,
                     piiBuffer,
git clone https://git.99rst.org/PROJECT