Adds ability to disable thought logging
This commit is contained in:
parent
fd047c059d
commit
e35fd67efd
1 changed files with 13 additions and 2 deletions
|
|
@ -25,6 +25,14 @@ interface ThoughtData {
|
||||||
class SequentialThinkingServer {
|
class SequentialThinkingServer {
|
||||||
private thoughtHistory: ThoughtData[] = [];
|
private thoughtHistory: ThoughtData[] = [];
|
||||||
private branches: Record<string, ThoughtData[]> = {};
|
private branches: Record<string, ThoughtData[]> = {};
|
||||||
|
private disableThoughtLogging: boolean; // <-- ADDED
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
// Disable logging if the ENV var is "1" or "true" (case-insensitive)
|
||||||
|
this.disableThoughtLogging =
|
||||||
|
process.env.DISABLE_THOUGHT_LOGGING === "1" ||
|
||||||
|
(process.env.DISABLE_THOUGHT_LOGGING || "").toLowerCase() === "true";
|
||||||
|
}
|
||||||
|
|
||||||
private validateThoughtData(input: unknown): ThoughtData {
|
private validateThoughtData(input: unknown): ThoughtData {
|
||||||
const data = input as Record<string, unknown>;
|
const data = input as Record<string, unknown>;
|
||||||
|
|
@ -100,8 +108,11 @@ class SequentialThinkingServer {
|
||||||
this.branches[validatedInput.branchId].push(validatedInput);
|
this.branches[validatedInput.branchId].push(validatedInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formattedThought = this.formatThought(validatedInput);
|
// --- ONLY LOG IF NOT DISABLED ---
|
||||||
console.error(formattedThought);
|
if (!this.disableThoughtLogging) {
|
||||||
|
const formattedThought = this.formatThought(validatedInput);
|
||||||
|
console.error(formattedThought);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: [{
|
content: [{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue