mirror of
https://gitea.ingwaz.work/Ingwaz/openbrain-mcp.git
synced 2026-06-15 22:07:08 +00:00
feat(query): surface truth scoring fields in query responses (#39)
This commit is contained in:
25
src/db.rs
25
src/db.rs
@@ -240,6 +240,12 @@ impl Database {
|
||||
metadata,
|
||||
created_at,
|
||||
expires_at,
|
||||
truth_value,
|
||||
truth_confidence,
|
||||
truth_category,
|
||||
truth_evaluated_at,
|
||||
ecan_sti,
|
||||
ecan_lti,
|
||||
(1 - (embedding <=> $1))::real AS vector_score,
|
||||
CASE
|
||||
WHEN search_query.query_text IS NULL THEN 0::real
|
||||
@@ -267,6 +273,12 @@ impl Database {
|
||||
metadata,
|
||||
created_at,
|
||||
expires_at,
|
||||
truth_value,
|
||||
truth_confidence,
|
||||
truth_category,
|
||||
truth_evaluated_at,
|
||||
ecan_sti,
|
||||
ecan_lti,
|
||||
vector_score,
|
||||
text_score,
|
||||
CASE
|
||||
@@ -306,13 +318,12 @@ impl Database {
|
||||
metadata: row.get("metadata"),
|
||||
created_at: row.get("created_at"),
|
||||
expires_at: row.get("expires_at"),
|
||||
// Truth fields will be populated by issue #39
|
||||
truth_value: None,
|
||||
truth_confidence: None,
|
||||
truth_category: None,
|
||||
truth_evaluated_at: None,
|
||||
ecan_sti: None,
|
||||
ecan_lti: None,
|
||||
truth_value: row.get("truth_value"),
|
||||
truth_confidence: row.get("truth_confidence"),
|
||||
truth_category: row.get("truth_category"),
|
||||
truth_evaluated_at: row.get("truth_evaluated_at"),
|
||||
ecan_sti: row.get("ecan_sti"),
|
||||
ecan_lti: row.get("ecan_lti"),
|
||||
},
|
||||
similarity: row.get("hybrid_score"),
|
||||
vector_score: row.get("vector_score"),
|
||||
|
||||
@@ -90,7 +90,13 @@ pub async fn execute(state: &Arc<AppState>, arguments: Value) -> Result<String>
|
||||
"keywords": m.record.keywords,
|
||||
"metadata": m.record.metadata,
|
||||
"created_at": m.record.created_at.to_rfc3339(),
|
||||
"expires_at": m.record.expires_at.as_ref().map(|ts| ts.to_rfc3339())
|
||||
"expires_at": m.record.expires_at.as_ref().map(|ts| ts.to_rfc3339()),
|
||||
"truth_value": m.record.truth_value,
|
||||
"truth_confidence": m.record.truth_confidence,
|
||||
"truth_category": m.record.truth_category,
|
||||
"truth_evaluated_at": m.record.truth_evaluated_at.map(|t| t.to_rfc3339()),
|
||||
"ecan_sti": m.record.ecan_sti,
|
||||
"ecan_lti": m.record.ecan_lti
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user