@heylemon/lemonade 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2a4035f52fce4d9fe44c89827996dcd95edfd7a57b34b64fd6cabe08241c4acf
|
|
@@ -286,7 +286,17 @@ export async function handleOpenAiHttpRequest(req, res, opts) {
|
|
|
286
286
|
}, defaultRuntime, deps);
|
|
287
287
|
if (closed)
|
|
288
288
|
return;
|
|
289
|
-
|
|
289
|
+
const payloads = result?.payloads;
|
|
290
|
+
const payloadContent = Array.isArray(payloads) && payloads.length > 0
|
|
291
|
+
? payloads
|
|
292
|
+
.map((p) => (typeof p.text === "string" ? p.text : ""))
|
|
293
|
+
.filter(Boolean)
|
|
294
|
+
.join("\n\n")
|
|
295
|
+
: "";
|
|
296
|
+
// Send payload content if nothing was streamed, or if the payloads
|
|
297
|
+
// contain the full response (agent may stream partial narration then
|
|
298
|
+
// return the complete answer in payloads after tool calls).
|
|
299
|
+
if (!sawAssistantDelta || payloadContent.length > 0) {
|
|
290
300
|
if (!wroteRole) {
|
|
291
301
|
wroteRole = true;
|
|
292
302
|
writeSse(res, {
|
|
@@ -297,13 +307,7 @@ export async function handleOpenAiHttpRequest(req, res, opts) {
|
|
|
297
307
|
choices: [{ index: 0, delta: { role: "assistant" } }],
|
|
298
308
|
});
|
|
299
309
|
}
|
|
300
|
-
const
|
|
301
|
-
const content = Array.isArray(payloads) && payloads.length > 0
|
|
302
|
-
? payloads
|
|
303
|
-
.map((p) => (typeof p.text === "string" ? p.text : ""))
|
|
304
|
-
.filter(Boolean)
|
|
305
|
-
.join("\n\n")
|
|
306
|
-
: "No response from Lemonade.";
|
|
310
|
+
const content = payloadContent || "No response from Lemonade.";
|
|
307
311
|
sawAssistantDelta = true;
|
|
308
312
|
writeSse(res, {
|
|
309
313
|
id: runId,
|