@ynhcj/xiaoyi-channel 0.0.183-next → 0.0.184-next
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/src/provider.js +5 -0
- package/package.json +1 -1
package/dist/src/provider.js
CHANGED
|
@@ -128,6 +128,7 @@ function createRetryingStream(createStream, cronJob) {
|
|
|
128
128
|
let hasContent = false;
|
|
129
129
|
const buffer = [];
|
|
130
130
|
let errorResult = null;
|
|
131
|
+
let fullResponseText = "";
|
|
131
132
|
for await (const event of stream) {
|
|
132
133
|
const isContent = CONTENT_EVENT_TYPES.has(event.type);
|
|
133
134
|
if (!hasContent && !isContent) {
|
|
@@ -156,8 +157,12 @@ function createRetryingStream(createStream, cronJob) {
|
|
|
156
157
|
// IMPORTANT: resolve result() BEFORE yielding terminal events to avoid deadlock.
|
|
157
158
|
// The SDK calls result() when it sees done/error — if we yield first, the generator
|
|
158
159
|
// suspends and can never reach resolve, causing a permanent deadlock.
|
|
160
|
+
if (event.type === "text_delta") {
|
|
161
|
+
fullResponseText += event.delta ?? "";
|
|
162
|
+
}
|
|
159
163
|
if (event.type === "done") {
|
|
160
164
|
logger.log(`[xiaoyiprovider] stream completed, usage: input=${event.message?.usage?.input} output=${event.message?.usage?.output}`);
|
|
165
|
+
logger.log(`[xiaoyiprovider] full model response: ${fullResponseText}`);
|
|
161
166
|
resultResolve(event.message);
|
|
162
167
|
yield event;
|
|
163
168
|
return;
|