adjust heartbeat
This commit is contained in:
@@ -1354,6 +1354,17 @@ class YouProvider {
|
|||||||
|
|
||||||
await setupEventSource(page, url, traceId, customEndMarker);
|
await setupEventSource(page, url, traceId, customEndMarker);
|
||||||
|
|
||||||
|
if (stream) {
|
||||||
|
heartbeatInterval = setInterval(() => {
|
||||||
|
if (!isEnding && !clientState.isClosed()) {
|
||||||
|
emitter.emit("completion", traceId, `\r`);
|
||||||
|
} else {
|
||||||
|
clearInterval(heartbeatInterval);
|
||||||
|
heartbeatInterval = null;
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("重新发送请求时发生错误:", error);
|
console.error("重新发送请求时发生错误:", error);
|
||||||
@@ -1409,7 +1420,7 @@ class YouProvider {
|
|||||||
if (stream) {
|
if (stream) {
|
||||||
heartbeatInterval = setInterval(() => {
|
heartbeatInterval = setInterval(() => {
|
||||||
if (!isEnding && !clientState.isClosed()) {
|
if (!isEnding && !clientState.isClosed()) {
|
||||||
emitter.emit("completion", traceId, " ");
|
emitter.emit("completion", traceId, `\r`);
|
||||||
} else {
|
} else {
|
||||||
clearInterval(heartbeatInterval);
|
clearInterval(heartbeatInterval);
|
||||||
heartbeatInterval = null;
|
heartbeatInterval = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user