vtcode_core/code/code_completion/learning/
mod.rs1pub mod data;
2pub mod feedback;
3
4pub use data::CompletionLearningData;
5pub use feedback::FeedbackProcessor;
6
7use std::collections::HashMap;
8
9pub struct LearningSystem {
11 learning_data: CompletionLearningData,
12 feedback_processor: FeedbackProcessor,
13}
14
15impl LearningSystem {
16 pub fn new() -> Self {
17 Self {
18 learning_data: CompletionLearningData::default(),
19 feedback_processor: FeedbackProcessor::new(),
20 }
21 }
22
23 pub fn process_feedback(&mut self, suggestion_text: &str, accepted: bool, context: &str) {
25 self.feedback_processor
26 .process(suggestion_text, accepted, context);
27 self.learning_data
28 .update_from_feedback(suggestion_text, accepted);
29 }
30
31 pub fn get_insights(&self, context: &str) -> HashMap<String, f64> {
33 self.learning_data.get_context_insights(context)
34 }
35}