@oxecli/oxe 1.0.32 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine.js +15 -2
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -49,6 +49,7 @@ export class InferenceEngine {
|
|
|
49
49
|
inQuery = false;
|
|
50
50
|
activeAbort = null;
|
|
51
51
|
interrupted = false;
|
|
52
|
+
queryHasOutput = false;
|
|
52
53
|
temperature;
|
|
53
54
|
storedResponseIds = [];
|
|
54
55
|
constructor(config) {
|
|
@@ -264,6 +265,8 @@ export class InferenceEngine {
|
|
|
264
265
|
finishThinking(true);
|
|
265
266
|
}
|
|
266
267
|
else if (etype === "response.output_text.delta") {
|
|
268
|
+
if (event.delta)
|
|
269
|
+
this.queryHasOutput = true;
|
|
267
270
|
reportWorking();
|
|
268
271
|
finishThinking(true);
|
|
269
272
|
content += event.delta;
|
|
@@ -424,6 +427,7 @@ export class InferenceEngine {
|
|
|
424
427
|
async executeQuery(userPrompt, inputItems, story, pasteSpans) {
|
|
425
428
|
this.inQuery = true;
|
|
426
429
|
this.interrupted = false;
|
|
430
|
+
this.queryHasOutput = false;
|
|
427
431
|
this.activeAbort = new AbortController();
|
|
428
432
|
hideCursor();
|
|
429
433
|
inputItems.push({
|
|
@@ -539,7 +543,8 @@ export class InferenceEngine {
|
|
|
539
543
|
return;
|
|
540
544
|
}
|
|
541
545
|
if (!calls.length) {
|
|
542
|
-
|
|
546
|
+
const gap = text.endsWith("\n\n") ? "" : text.endsWith("\n") ? "\n" : "\n\n";
|
|
547
|
+
process.stdout.write(gap + summary() + "\n");
|
|
543
548
|
story.push({ type: "footer", text: footerText() });
|
|
544
549
|
attachFooter(conversation);
|
|
545
550
|
attachFooter(inputItems);
|
|
@@ -586,6 +591,15 @@ export class InferenceEngine {
|
|
|
586
591
|
stripOrphanCalls(inputItems);
|
|
587
592
|
}
|
|
588
593
|
catch (err) {
|
|
594
|
+
if (this.interrupted && !this.queryHasOutput) {
|
|
595
|
+
const fallback = "What else can I help with?";
|
|
596
|
+
process.stdout.write(aiMarkdown(fallback) + "\n\n" + summary() + "\n");
|
|
597
|
+
story.push({ type: "assistant", text: fallback });
|
|
598
|
+
story.push({ type: "footer", text: footerText() });
|
|
599
|
+
attachFooter(conversation);
|
|
600
|
+
attachFooter(inputItems);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
589
603
|
if (this.interrupted)
|
|
590
604
|
throw new Error("interrupt");
|
|
591
605
|
if (err?.message === "interrupt" || err?.message === "eof") {
|
|
@@ -615,6 +629,5 @@ export class InferenceEngine {
|
|
|
615
629
|
function renderErrorPanel(msg) {
|
|
616
630
|
const text = msg.replace(/\[bold yellow\]|\[yellow\]|\[\/.*?\]/g, "");
|
|
617
631
|
renderPanel(text, "Error", "", true, "31");
|
|
618
|
-
process.stdout.write("\n");
|
|
619
632
|
}
|
|
620
633
|
export { renderErrorPanel };
|