Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions servers/legacy/mcp_base_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# MCP Protocol imports
try:
from mcp.server import Server
from mcp.types import Tool, TextContent, ImageContent, EmbeddedResource
from mcp.types import Tool, TextContent
from mcp.server.stdio import stdio_server
from mcp.server.models import InitializationOptions
except ImportError:
Expand Down Expand Up @@ -261,7 +261,7 @@ async def _load_ml_model_lazy(self):

# Step 4: Test prediction
progress.update()
test_result = self.ml_model(f"Test message for {self.platform_name} initialization")
self.ml_model(f"Test message for {self.platform_name} initialization")

progress.update()
print(f"\n✅ [{self.platform_name.upper()}] Modello ML caricato e testato!")
Expand Down Expand Up @@ -371,7 +371,7 @@ async def _handle_search_memory(self, arguments: Dict[str, Any]) -> List[TextCon
async def _handle_analyze_message(self, arguments: Dict[str, Any]) -> List[TextContent]:
"""Handle analyze_message tool call"""
message = arguments.get("message", "")
platform_context = arguments.get("platform_context", {})
arguments.get("platform_context", {})

if not message.strip():
return [TextContent(type="text", text="❌ Cannot analyze empty message")]
Expand Down
2 changes: 1 addition & 1 deletion servers/legacy/windsurf_mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ async def _handle_save_code_snippet(self, arguments: Dict[str, Any]) -> List[Tex
}

# Save using base functionality
save_result = await self._handle_save_memory({
await self._handle_save_memory({
"content": content,
"context": context
})
Expand Down
1 change: 0 additions & 1 deletion src/core/hybrid_trigger_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ async def _combine_predictions(
) -> HybridPrediction:
"""Combine predictions from both systems"""

reasoning = []

# Mode-specific logic
if self.mode == TriggerMode.DETERMINISTIC:
Expand Down
2 changes: 1 addition & 1 deletion src/core/mcp_server_enhanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ async def _handle_register_conversation(self, arguments: Dict[str, Any]) -> List
try:
messages = arguments.get("messages", [])
platform = arguments.get("platform", "unknown")
context = arguments.get("context", {})
arguments.get("context", {})

# Store conversation in buffer
self.conversation_buffer[platform] = messages
Expand Down
9 changes: 3 additions & 6 deletions src/core/ml_trigger_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,17 @@

# ML imports
try:
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import StandardScaler
from sklearn.neural_network import MLPClassifier

HAS_SKLEARN = True
except ImportError:
HAS_SKLEARN = False

try:
import torch
import torch.nn as nn
import torch.optim as optim
from transformers import AutoTokenizer, AutoModel, AutoModelForSequenceClassification, pipeline
from transformers import pipeline
HAS_TORCH = True
except ImportError:
HAS_TORCH = False
Expand Down
2 changes: 1 addition & 1 deletion src/core/simple_mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async def handle_call_tool(name: str, arguments: dict) -> List[types.TextContent
# Save memory
memory = await self.db.save_memory(content, importance, memory_type, metadata)

result = {
{
"success": True,
"memory_id": memory["id"],
"content": content,
Expand Down
2 changes: 1 addition & 1 deletion src/services/health_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def check_all(self) -> bool:
async def get_health_status(self) -> HealthCheckResponse:
"""Get comprehensive health status"""
try:
start_time = time.time()
time.time()

# Check individual services
db_health = await database_service.health_check()
Expand Down
6 changes: 0 additions & 6 deletions src/services/memory_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,18 @@ async def auto_save_memory(
importance = await self.embedding_service.analyze_memory_importance(content, context)

# Determine memory type from context
memory_type = MemoryType.CONVERSATION
trigger_type = "ml_trigger"

if context:
if context.get("type") == "function_result":
memory_type = MemoryType.FUNCTION
trigger_type = "function_result"
elif context.get("level") == "error":
memory_type = MemoryType.ERROR
trigger_type = "error"
elif context.get("level") == "warning":
memory_type = MemoryType.WARNING
trigger_type = "warning"
elif "decision" in content.lower():
memory_type = MemoryType.DECISION
trigger_type = "decision"
elif any(keyword in content.lower() for keyword in ["knowledge", "fact", "information"]):
memory_type = MemoryType.KNOWLEDGE
trigger_type = "knowledge"

# Create memory
Expand Down
4 changes: 2 additions & 2 deletions src/training/comprehensive_dataset_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

# ML imports
try:
from datasets import Dataset, DatasetDict, load_dataset, concatenate_datasets
from datasets import Dataset, DatasetDict, load_dataset
from sklearn.model_selection import train_test_split
from huggingface_hub import upload_file, create_repo, login
from huggingface_hub import create_repo, login
HAS_DATASETS = True
except ImportError:
HAS_DATASETS = False
Expand Down
2 changes: 1 addition & 1 deletion src/training/dataset_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ML imports
try:
from datasets import Dataset, DatasetDict, load_dataset
from transformers import AutoTokenizer

from sklearn.model_selection import train_test_split
HAS_DATASETS = True
except ImportError:
Expand Down
3 changes: 1 addition & 2 deletions src/training/ml_training_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
import pandas as pd

HAS_SKLEARN = True
except ImportError:
HAS_SKLEARN = False
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_full_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ async def test_auto_save_workflow(self, services):
"""Test auto-save workflow"""
# Arrange
memory_service = services["memory"]
embedding_service = services["embedding"]
services["embedding"]

# Test content that should trigger auto-save
test_content = """
Expand Down
2 changes: 1 addition & 1 deletion tests/test_advanced_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def test_cache_service():
"importance": 0.8
}

cache_key = await cache_service.get_memory_cache_key("test_memory_123")
await cache_service.get_memory_cache_key("test_memory_123")
await cache_service.cache_memory(memory_data)
cached_memory = await cache_service.get_cached_memory("test_memory_123")
print(f"✅ Memory cache: {cached_memory is not None}")
Expand Down