公众号验证码功能完成 yeah!!!
This commit is contained in:
29
node_modules/openai/lib/responses/ResponseStream.js
generated
vendored
29
node_modules/openai/lib/responses/ResponseStream.js
generated
vendored
@@ -132,8 +132,16 @@ class ResponseStream extends EventStream_1.EventStream {
|
||||
if (!output) {
|
||||
throw new error_1.OpenAIError(`missing output at index ${event.output_index}`);
|
||||
}
|
||||
if (output.type === 'message') {
|
||||
output.content.push(event.part);
|
||||
const type = output.type;
|
||||
const part = event.part;
|
||||
if (type === 'message' && part.type !== 'reasoning_text') {
|
||||
output.content.push(part);
|
||||
}
|
||||
else if (type === 'reasoning' && part.type === 'reasoning_text') {
|
||||
if (!output.content) {
|
||||
output.content = [];
|
||||
}
|
||||
output.content.push(part);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -164,6 +172,23 @@ class ResponseStream extends EventStream_1.EventStream {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'response.reasoning_text.delta': {
|
||||
const output = snapshot.output[event.output_index];
|
||||
if (!output) {
|
||||
throw new error_1.OpenAIError(`missing output at index ${event.output_index}`);
|
||||
}
|
||||
if (output.type === 'reasoning') {
|
||||
const content = output.content?.[event.content_index];
|
||||
if (!content) {
|
||||
throw new error_1.OpenAIError(`missing content at index ${event.content_index}`);
|
||||
}
|
||||
if (content.type !== 'reasoning_text') {
|
||||
throw new error_1.OpenAIError(`expected content to be 'reasoning_text', got ${content.type}`);
|
||||
}
|
||||
content.text += event.delta;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'response.completed': {
|
||||
tslib_1.__classPrivateFieldSet(this, _ResponseStream_currentResponseSnapshot, event.response, "f");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user