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>>) {
|
async renderStream(stream: AsyncIterableStream<TextStreamPart<ToolSet>>) {
|
||||||
this.resetCounts();
|
this.resetCounts();
|
||||||
|
|
||||||
|
let reasonStart = 0;
|
||||||
|
|
||||||
const spin = spinner({ withGuide: false, indicator: "timer" });
|
const spin = spinner({ withGuide: false, indicator: "timer" });
|
||||||
if (!this.isPlain) {
|
if (!this.isPlain) {
|
||||||
spin.start("Waiting for response");
|
spin.start("Waiting for response");
|
||||||
|
|
@ -96,6 +98,7 @@ export default class Renderer {
|
||||||
for await (const part of stream) {
|
for await (const part of stream) {
|
||||||
switch (part.type) {
|
switch (part.type) {
|
||||||
case "reasoning-start": {
|
case "reasoning-start": {
|
||||||
|
reasonStart = Date.now();
|
||||||
spin.clear();
|
spin.clear();
|
||||||
if (supportsColorStderr)
|
if (supportsColorStderr)
|
||||||
this.write(
|
this.write(
|
||||||
|
|
@ -118,6 +121,8 @@ export default class Renderer {
|
||||||
} else {
|
} else {
|
||||||
this.write("\n--- Done Thinking ---\n", process.stderr);
|
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)
|
if (supportsColorStderr)
|
||||||
this.write(
|
this.write(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue