fix(cache): honest settings card — clean threshold, live stats, no-embedder warning
Full audit of the semantic cache against a live instance (mock embedder, identical requests): the mechanism works — miss at 3.1s, then hits at 2ms with entries/hits/saved-$ counting. Two honest gaps fixed: - the threshold round-tripped through f32 and rendered as 0.9200000166893005 in both the TOML and the settings input — the config field is f64 now (writes exactly what you typed) and the input rounds legacy values to 2 decimals; - the card now shows proof of life (entries / hits / hit-rate / saved $) and, when the cache is enabled with NO embedding model available, a warning that it is silently doing nothing and how to fix it — previously that state looked identical to a working cache. Also audited in the same pass, no changes needed: Prometheus /metrics (toggle on/off applies live, 404 when off), and all 7 protocol switches (each gates its endpoint instantly both ways). 4 strings ×7 languages.
This commit is contained in:
+4
-3
@@ -829,9 +829,10 @@ fn default_shadow_soak() -> usize {
|
||||
pub struct CacheCfg {
|
||||
#[serde(default)]
|
||||
pub enabled: bool,
|
||||
/// Cosine-similarity threshold for a hit (0..1).
|
||||
/// Cosine-similarity threshold for a hit (0..1). f64 so the TOML holds
|
||||
/// the number you typed (an f32 round-trips as 0.9200000166893005).
|
||||
#[serde(default = "default_semcache_threshold")]
|
||||
pub threshold: f32,
|
||||
pub threshold: f64,
|
||||
/// Entry time-to-live, e.g. `1h`.
|
||||
#[serde(default = "default_semcache_ttl")]
|
||||
pub ttl: String,
|
||||
@@ -853,7 +854,7 @@ impl Default for CacheCfg {
|
||||
}
|
||||
}
|
||||
}
|
||||
fn default_semcache_threshold() -> f32 {
|
||||
fn default_semcache_threshold() -> f64 {
|
||||
0.92
|
||||
}
|
||||
fn default_semcache_ttl() -> String {
|
||||
|
||||
Reference in New Issue
Block a user