Muyue df61668c79 Fix: resolve compilation errors
- Fix screenshot capture to use correct API from screenshots library
- Remove unused imports and methods
- Add missing trait imports (OptionalExtension, Timelike, Hash)
- Fix type conversions in database operations
- Fix encryption salt conversion

Compilation successful!
2025-10-16 09:41:37 +02:00

84 lines
1.9 KiB
Rust

/// Analysis module - AI-powered activity classification
/// For MVP: uses heuristic-based classification
/// Future: integrate Mistral 7B for advanced analysis
pub mod classifier;
pub mod entities;
pub use classifier::{Classifier, ClassificationResult};
pub use entities::EntityExtractor;
use serde::{Deserialize, Serialize};
/// Available activity categories (as per MVP spec)
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ActivityCategory {
Development,
Meeting,
Research,
Design,
Other,
}
impl ActivityCategory {
pub fn as_str(&self) -> &'static str {
match self {
Self::Development => "Development",
Self::Meeting => "Meeting",
Self::Research => "Research",
Self::Design => "Design",
Self::Other => "Other",
}
}
pub fn from_str(s: &str) -> Self {
match s.to_lowercase().as_str() {
"development" => Self::Development,
"meeting" => Self::Meeting,
"research" => Self::Research,
"design" => Self::Design,
_ => Self::Other,
}
}
pub fn all() -> Vec<Self> {
vec![
Self::Development,
Self::Meeting,
Self::Research,
Self::Design,
Self::Other,
]
}
}
/// Extracted entities from activity
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Entities {
pub project: Option<String>,
pub tool: Option<String>,
pub language: Option<String>,
pub other: Vec<String>,
}
impl Entities {
pub fn new() -> Self {
Self {
project: None,
tool: None,
language: None,
other: Vec::new(),
}
}
pub fn to_json(&self) -> String {
serde_json::to_string(self).unwrap_or_default()
}
}
impl Default for Entities {
fn default() -> Self {
Self::new()
}
}