🚸 Show all prompts and completions in VS Code output panel
This commit is contained in:
parent
050c87a754
commit
d080c8ed30
2 changed files with 31 additions and 3 deletions
|
|
@ -380,11 +380,11 @@ export abstract class BaseLLM implements ILLM {
|
|||
.map(([key, value]) => `${key}: ${value}`)
|
||||
.join("\n");
|
||||
return `Settings:
|
||||
${settings}
|
||||
${settings}
|
||||
|
||||
############################################
|
||||
############################################
|
||||
|
||||
${prompt}`;
|
||||
${prompt}`;
|
||||
}
|
||||
|
||||
private _logTokensGenerated(model: string, completion: string) {
|
||||
|
|
@ -499,6 +499,10 @@ export abstract class BaseLLM implements ILLM {
|
|||
|
||||
this._logTokensGenerated(completionOptions.model, completion);
|
||||
|
||||
if (log && this.writeLog) {
|
||||
await this.writeLog(`Completion:\n\n${completion}\n\n`);
|
||||
}
|
||||
|
||||
return { prompt, completion };
|
||||
}
|
||||
|
||||
|
|
@ -539,6 +543,10 @@ export abstract class BaseLLM implements ILLM {
|
|||
const completion = await this._complete(prompt, completionOptions);
|
||||
|
||||
this._logTokensGenerated(completionOptions.model, completion);
|
||||
if (log && this.writeLog) {
|
||||
await this.writeLog(`Completion:\n\n${completion}\n\n`);
|
||||
}
|
||||
|
||||
return completion;
|
||||
}
|
||||
|
||||
|
|
@ -611,6 +619,10 @@ export abstract class BaseLLM implements ILLM {
|
|||
}
|
||||
|
||||
this._logTokensGenerated(completionOptions.model, completion);
|
||||
if (log && this.writeLog) {
|
||||
await this.writeLog(`Completion:\n\n${completion}\n\n`);
|
||||
}
|
||||
|
||||
return { prompt, completion };
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
import { ContinueConfig, IDE, ILLM } from "core";
|
||||
import * as fs from "fs";
|
||||
import { Agent, ProxyAgent, fetch } from "undici";
|
||||
import * as vscode from "vscode";
|
||||
import { webviewRequest } from "./debugPanel";
|
||||
import { VsCodeIde, loadFullConfigNode } from "./ideProtocol";
|
||||
const tls = require("tls");
|
||||
|
||||
const outputChannel = vscode.window.createOutputChannel(
|
||||
"Continue - LLM Prompt/Completion"
|
||||
);
|
||||
|
||||
class VsCodeConfigHandler {
|
||||
savedConfig: ContinueConfig | undefined;
|
||||
|
||||
|
|
@ -100,5 +105,16 @@ export async function llmFromTitle(title?: string): Promise<ILLM> {
|
|||
});
|
||||
};
|
||||
|
||||
llm.writeLog = async (log: string) => {
|
||||
outputChannel.appendLine(
|
||||
"=========================================================================="
|
||||
);
|
||||
outputChannel.appendLine(
|
||||
"=========================================================================="
|
||||
);
|
||||
|
||||
outputChannel.append(log);
|
||||
};
|
||||
|
||||
return llm;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue