fix: only clear spinner when it was actually spinning
This commit is contained in:
parent
3c9a5e625a
commit
8ff27c5de8
1 changed files with 4 additions and 2 deletions
|
|
@ -89,14 +89,16 @@ export default class Renderer {
|
||||||
this.resetCounts();
|
this.resetCounts();
|
||||||
|
|
||||||
const spin = spinner({ withGuide: false, indicator: "timer" });
|
const spin = spinner({ withGuide: false, indicator: "timer" });
|
||||||
|
let spinning = false;
|
||||||
if (!this.isPlain) {
|
if (!this.isPlain) {
|
||||||
|
spinning = true;
|
||||||
spin.start("Waiting for response");
|
spin.start("Waiting for response");
|
||||||
}
|
}
|
||||||
|
|
||||||
for await (const part of stream) {
|
for await (const part of stream) {
|
||||||
switch (part.type) {
|
switch (part.type) {
|
||||||
case "reasoning-start": {
|
case "reasoning-start": {
|
||||||
if (!this.isPlain) {
|
if (spinning) {
|
||||||
spin.clear();
|
spin.clear();
|
||||||
}
|
}
|
||||||
if (supportsColorStderr)
|
if (supportsColorStderr)
|
||||||
|
|
@ -130,7 +132,7 @@ export default class Renderer {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "text-start": {
|
case "text-start": {
|
||||||
if (!this.isPlain) {
|
if (spinning) {
|
||||||
spin.clear();
|
spin.clear();
|
||||||
}
|
}
|
||||||
this.write("\n");
|
this.write("\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue