chore: align slurp config and scaffolding
This commit is contained in:
@@ -4,14 +4,13 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"chorus/pkg/ucxl"
|
||||
slurpContext "chorus/pkg/slurp/context"
|
||||
"chorus/pkg/ucxl"
|
||||
)
|
||||
|
||||
// AnalyzeFile analyzes a single file and generates contextual understanding
|
||||
@@ -136,8 +135,7 @@ func (e *DefaultIntelligenceEngine) AnalyzeDirectory(ctx context.Context, dirPat
|
||||
}()
|
||||
|
||||
// Analyze directory structure
|
||||
structure, err := e.directoryAnalyzer.AnalyzeStructure(ctx, dirPath)
|
||||
if err != nil {
|
||||
if _, err := e.directoryAnalyzer.AnalyzeStructure(ctx, dirPath); err != nil {
|
||||
e.updateStats("directory_analysis", time.Since(start), false)
|
||||
return nil, fmt.Errorf("failed to analyze directory structure: %w", err)
|
||||
}
|
||||
@@ -232,7 +230,7 @@ func (e *DefaultIntelligenceEngine) AnalyzeBatch(ctx context.Context, filePaths
|
||||
wg.Add(1)
|
||||
go func(path string) {
|
||||
defer wg.Done()
|
||||
semaphore <- struct{}{} // Acquire semaphore
|
||||
semaphore <- struct{}{} // Acquire semaphore
|
||||
defer func() { <-semaphore }() // Release semaphore
|
||||
|
||||
ctxNode, err := e.AnalyzeFile(ctx, path, role)
|
||||
@@ -317,7 +315,7 @@ func (e *DefaultIntelligenceEngine) EnhanceWithRAG(ctx context.Context, node *sl
|
||||
if ragResponse.Confidence >= e.config.MinConfidenceThreshold {
|
||||
enhanced.Insights = append(enhanced.Insights, fmt.Sprintf("RAG: %s", ragResponse.Answer))
|
||||
enhanced.RAGConfidence = ragResponse.Confidence
|
||||
|
||||
|
||||
// Add source information to metadata
|
||||
if len(ragResponse.Sources) > 0 {
|
||||
sources := make([]string, len(ragResponse.Sources))
|
||||
@@ -430,7 +428,7 @@ func (e *DefaultIntelligenceEngine) readFileContent(filePath string) ([]byte, er
|
||||
func (e *DefaultIntelligenceEngine) generateUCXLAddress(filePath string) (*ucxl.Address, error) {
|
||||
// Simple implementation - in reality this would be more sophisticated
|
||||
cleanPath := filepath.Clean(filePath)
|
||||
addr, err := ucxl.ParseAddress(fmt.Sprintf("file://%s", cleanPath))
|
||||
addr, err := ucxl.Parse(fmt.Sprintf("file://%s", cleanPath))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to generate UCXL address: %w", err)
|
||||
}
|
||||
@@ -640,6 +638,10 @@ func DefaultEngineConfig() *EngineConfig {
|
||||
RAGEndpoint: "",
|
||||
RAGTimeout: 10 * time.Second,
|
||||
RAGEnabled: false,
|
||||
EnableRAG: false,
|
||||
EnableGoalAlignment: false,
|
||||
EnablePatternDetection: false,
|
||||
EnableRoleAware: false,
|
||||
MinConfidenceThreshold: 0.6,
|
||||
RequireValidation: true,
|
||||
CacheEnabled: true,
|
||||
@@ -647,4 +649,4 @@ func DefaultEngineConfig() *EngineConfig {
|
||||
RoleProfiles: make(map[string]*RoleProfile),
|
||||
ProjectGoals: []*ProjectGoal{},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user