remove some env vars

This commit is contained in:
overcuriousity
2025-08-17 18:17:33 +02:00
parent bcd92af8a0
commit 2cb25d1dd6
7 changed files with 149 additions and 167 deletions

View File

@@ -11,7 +11,7 @@ import 'dotenv/config';
interface PipelineConfig {
microTaskDelay: number;
maxContextTokens: number;
//maxContextTokens: number;
maxPromptTokens: number;
taskRelevanceModeration: {
maxInitialScore: number;
@@ -36,7 +36,7 @@ interface MicroTaskResult {
interface AnalysisResult {
recommendation: any;
processingStats: {
embeddingsUsed: boolean;
//embeddingsUsed: boolean;
candidatesFromEmbeddings: number;
finalSelectedItems: number;
processingTimeMs: number;
@@ -57,7 +57,7 @@ interface PipelineContext {
mode: string;
filteredData: any;
contextHistory: string[];
maxContextLength: number;
//maxContextLength: number;
currentContextLength: number;
scenarioAnalysis?: string;
problemAnalysis?: string;
@@ -91,7 +91,7 @@ class AIPipeline {
constructor() {
this.config = {
microTaskDelay: parseInt(process.env.AI_MICRO_TASK_DELAY_MS || '500', 10),
maxContextTokens: parseInt(process.env.AI_MAX_CONTEXT_TOKENS || '4000', 10),
//maxContextTokens: parseInt(process.env.AI_MAX_CONTEXT_TOKENS || '4000', 10),
maxPromptTokens: parseInt(process.env.AI_MAX_PROMPT_TOKENS || '1500', 10),
taskRelevanceModeration: {
maxInitialScore: 85,
@@ -123,7 +123,7 @@ class AIPipeline {
mode,
filteredData: {},
contextHistory: [],
maxContextLength: this.config.maxContextTokens,
//maxContextLength: this.config.maxContextTokens,
currentContextLength: 0,
seenToolNames: new Set<string>(),
embeddingsSimilarities: new Map<string, number>(),
@@ -138,20 +138,20 @@ class AIPipeline {
const selectionConfidence = this.calculateToolSelectionConfidence(
candidateData.tools.length,
toolsData.tools.length,
candidateData.selectionMethod,
//candidateData.selectionMethod,
candidateData.concepts.length
);
auditService.addToolSelection(
candidateData.tools.map(t => t.name),
toolsData.tools.map(t => t.name),
candidateData.selectionMethod,
//candidateData.selectionMethod,
selectionConfidence,
candidateSelectionStart,
{
embeddingsUsed: embeddingsService.isEnabled(),
//embeddingsUsed: embeddingsService.isEnabled(),
totalCandidatesFound: candidateData.tools.length + candidateData.concepts.length,
selectionMethod: candidateData.selectionMethod,
//selectionMethod: candidateData.selectionMethod,
reductionRatio: candidateData.tools.length / toolsData.tools.length
}
);
@@ -201,7 +201,7 @@ class AIPipeline {
const recommendation = this.buildRecommendation(context, mode, finalResult.content);
const processingStats = {
embeddingsUsed: embeddingsService.isEnabled(),
//embeddingsUsed: embeddingsService.isEnabled(),
candidatesFromEmbeddings: candidateData.tools.length,
finalSelectedItems: (context.selectedTools?.length || 0) + (context.backgroundKnowledge?.length || 0),
processingTimeMs: Date.now() - startTime,
@@ -213,7 +213,7 @@ class AIPipeline {
aiModel: aiConfig.model,
toolsDataHash,
temperature: 0.3,
maxTokensUsed: 2500
maxTokensUsed: 32768
};
console.log('[AI-PIPELINE] Pipeline completed successfully:', {
@@ -292,7 +292,7 @@ class AIPipeline {
private calculateToolSelectionConfidence(
selectedCount: number,
totalCount: number,
method: string,
//method: string,
conceptsCount: number
): number {
let confidence = 50;
@@ -307,9 +307,9 @@ class AIPipeline {
confidence -= 15;
}
if (method.includes('embeddings')) {
confidence += 15;
}
//if (method.includes('embeddings')) {
//confidence += 15;
//}
if (conceptsCount > 0) {
confidence += 10;
@@ -1280,10 +1280,12 @@ class AIPipeline {
context.contextHistory.push(newEntry);
context.currentContextLength += entryTokens;
while (context.currentContextLength > this.config.maxContextTokens && context.contextHistory.length > 1) {
/*while (context.currentContextLength > this.config.maxContextTokens && context.contextHistory.length > 1) {
const removed = context.contextHistory.shift()!;
context.currentContextLength -= aiService.estimateTokens(removed);
}
}*/
const removed = context.contextHistory.shift()!;
context.currentContextLength -= aiService.estimateTokens(removed);
}
private addToolToSelection(