feat: show reasoning duration after thinking phase
This commit is contained in:
parent
7f0498fc84
commit
a6422c51aa
1 changed files with 5 additions and 0 deletions
|
|
@ -88,6 +88,8 @@ export default class Renderer {
|
|||
async renderStream(stream: AsyncIterableStream<TextStreamPart<ToolSet>>) {
|
||||
this.resetCounts();
|
||||
|
||||
let reasonStart = 0;
|
||||
|
||||
const spin = spinner({ withGuide: false, indicator: "timer" });
|
||||
if (!this.isPlain) {
|
||||
spin.start("Waiting for response");
|
||||
|
|
@ -96,6 +98,7 @@ export default class Renderer {
|
|||
for await (const part of stream) {
|
||||
switch (part.type) {
|
||||
case "reasoning-start": {
|
||||
reasonStart = Date.now();
|
||||
spin.clear();
|
||||
if (supportsColorStderr)
|
||||
this.write(
|
||||
|
|
@ -118,6 +121,8 @@ export default class Renderer {
|
|||
} else {
|
||||
this.write("\n--- Done Thinking ---\n", process.stderr);
|
||||
}
|
||||
const time = (Date.now() - reasonStart) / 1000;
|
||||
this.write(`Thought for ${time.toFixed(2)}s\n`, process.stderr);
|
||||
|
||||
if (supportsColorStderr)
|
||||
this.write(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue