MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / frecency_score

Method frecency_score

crates/opencode-tui/src/components/prompt.rs:727–735  ·  view source on GitHub ↗
(&self, key: &str)

Source from the content-addressed store, hash-verified

725 }
726
727 fn frecency_score(&self, key: &str) -> f64 {
728 let Some(entry) = self.frecency.get(key) else {
729 return 0.0;
730 };
731 let now = chrono::Utc::now().timestamp_millis();
732 let days_since = (now - entry.last_used).max(0) as f64 / 86_400_000.0;
733 let weight = 1.0 / (1.0 + days_since);
734 entry.frequency as f64 * weight
735 }
736
737 fn selected_suggestion(&self) -> Option<&str> {
738 self.suggestion_index

Callers 1

recompute_suggestionsMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected