Skip to content

Commit deccd2a

Browse files
authored
Merge pull request #23 from TheNotelyApp/ai_det
Removed Local AI and added MCP tools
2 parents 0646517 + 5869f34 commit deccd2a

72 files changed

Lines changed: 11757 additions & 5223 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎ai/core/AIService.js‎

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,12 @@ class AIService {
3838

3939
try {
4040
log.info('Initializing AI Service...');
41-
// Dynamic require of index.js bootstrap to initialize the agent
4241
const { initializeAISystem } = require('../index.js');
4342
const result = await initializeAISystem(appDataDir, workspaceRoot, llmProvider, embeddingConfig);
4443
const { getAIAgent } = require('../index.js');
4544
this.agent = getAIAgent();
4645

47-
const AIFlow = require('./AIFlow');
48-
this.aiFlow = new AIFlow(this.agent);
49-
this.agent.aiFlow = this.aiFlow;
50-
51-
log.info('AI Service & AIFlow Orchestrator successfully initialized');
46+
log.info('AI Service successfully initialized (embeddings + graph ready)');
5247
return result;
5348
} catch (error) {
5449
log.error('Failed to initialize AI Service:', error.message);
@@ -120,14 +115,12 @@ class AIService {
120115
const { shutdownAISystem } = require('../index.js');
121116
shutdownAISystem();
122117
this.agent = null;
123-
this.aiFlow = null;
124118
}
125119

126120
shutdown() {
127121
const { shutdownAISystem } = require('../index.js');
128122
shutdownAISystem();
129123
this.agent = null;
130-
this.aiFlow = null;
131124
log.info('AI Service shut down');
132125
}
133126

@@ -227,78 +220,6 @@ class AIService {
227220
}
228221
}
229222

230-
async chat(message, context = {}) {
231-
if (!this.enabled || !this.agent) {
232-
throw new Error('AI is currently disabled or uninitialized.');
233-
}
234-
if (!this.aiFlow) {
235-
const AIFlow = require('./AIFlow');
236-
this.aiFlow = new AIFlow(this.agent);
237-
this.agent.aiFlow = this.aiFlow;
238-
}
239-
return this.aiFlow.execute(message, context);
240-
}
241-
242-
/**
243-
* Main chat query streaming wrapper
244-
*/
245-
async stream(message, context = {}, onChunk, abortSignal) {
246-
if (!this.enabled || !this.agent) {
247-
throw new Error('AI is currently disabled or uninitialized.');
248-
}
249-
if (!this.aiFlow) {
250-
const AIFlow = require('./AIFlow');
251-
this.aiFlow = new AIFlow(this.agent);
252-
this.agent.aiFlow = this.aiFlow;
253-
}
254-
return this.aiFlow.stream(message, context, onChunk, abortSignal);
255-
}
256-
257-
// --- Facade API Methods for Subsystem Modules ---
258-
259-
getGraphStatus() {
260-
return this.agent?.graphDb ? this.agent.graphDb.getStatus() : null;
261-
}
262-
263-
getGraphData() {
264-
return this.agent?.graphDb ? this.agent.graphDb.getAll() : null;
265-
}
266-
267-
clearGraphData() {
268-
if (this.agent?.graphDb) {
269-
this.agent.graphDb.clearAllData();
270-
}
271-
}
272-
273-
async buildGraph(onProgress) {
274-
return this.agent ? this.agent.buildRelationshipGraph(onProgress) : { success: false, error: 'Agent not initialized' };
275-
}
276-
277-
getEmbeddingStats() {
278-
return this.agent?.embeddingDb ? this.agent.embeddingDb.getStats() : null;
279-
}
280-
281-
clearEmbeddingData() {
282-
if (this.agent?.embeddingDb) {
283-
this.agent.embeddingDb.clearAllData();
284-
}
285-
}
286-
287-
async generateEmbeddings(forceRefresh = false) {
288-
return this.agent ? this.agent.generateEmbeddings(forceRefresh) : { success: false, error: 'Agent not initialized' };
289-
}
290-
291-
detectPatterns() {
292-
return this.agent ? this.agent.detectPatterns() : { success: false, error: 'Agent not initialized' };
293-
}
294-
295-
getConversationStore() {
296-
return this.agent?.conversationStore || null;
297-
}
298-
299-
getPersonaManager() {
300-
return this.agent?.personaManager || null;
301-
}
302223
}
303224

304225
const aiServiceInstance = new AIService();

‎ai/core/Agent.js‎

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,39 +117,9 @@ class Agent {
117117
}
118118
}
119119

120-
/**
121-
* Process a query via AIFlow orchestrator
122-
*/
123-
async query(userQuery, context = {}) {
124-
if (!this.isInitialized) {
125-
throw new Error('Agent not initialized');
126-
}
127120

128-
if (this.aiFlow) {
129-
return this.aiFlow.execute(userQuery, context);
130-
}
121+
// query() and stream() removed — chat moved to MCP layer
131122

132-
const AIFlow = require('./AIFlow');
133-
this.aiFlow = new AIFlow(this);
134-
return this.aiFlow.execute(userQuery, context);
135-
}
136-
137-
/**
138-
* Process a query with streaming output via AIFlow orchestrator
139-
*/
140-
async stream(userQuery, context = {}, onChunk, abortSignal) {
141-
if (!this.isInitialized) {
142-
throw new Error('Agent not initialized');
143-
}
144-
145-
if (this.aiFlow) {
146-
return this.aiFlow.stream(userQuery, context, onChunk, abortSignal);
147-
}
148-
149-
const AIFlow = require('./AIFlow');
150-
this.aiFlow = new AIFlow(this);
151-
return this.aiFlow.stream(userQuery, context, onChunk, abortSignal);
152-
}
153123

154124
/**
155125
* Generate embeddings for workspace

0 commit comments

Comments
 (0)