chore: rename get_id to id, add doc comments, pre-allocate format_history

This commit is contained in:
Per Stark
2026-05-27 18:06:16 +02:00
parent 224a7db451
commit 30bb59f243
16 changed files with 52 additions and 25 deletions
+1 -1
View File
@@ -340,7 +340,7 @@ pub async fn ensure_corpus(
corpus_questions.push(CorpusQuestion {
question_id: case.question.id.clone(),
paragraph_id: case.paragraph.id.clone(),
text_content_id: record.shard.text_content.get_id().to_string(),
text_content_id: record.shard.text_content.id().to_string(),
question_text: case.question.question.clone(),
answers: case.question.answers.clone(),
is_impossible: case.question.is_impossible,
+1 -1
View File
@@ -575,7 +575,7 @@ fn validate_answers(
if chunk_text.contains(&needle)
|| (!needle_norm.is_empty() && chunk_norm.contains(&needle_norm))
{
matches.insert(chunk.chunk.get_id().to_string());
matches.insert(chunk.chunk.id().to_string());
found_any = true;
}
}
+1 -1
View File
@@ -216,7 +216,7 @@ pub(crate) async fn ensure_eval_user(db: &SurrealDbClient) -> Result<User> {
theme: Theme::System,
};
if let Some(existing) = db.get_item::<User>(user.get_id()).await? {
if let Some(existing) = db.get_item::<User>(user.id()).await? {
return Ok(existing);
}
@@ -247,7 +247,7 @@ pub(crate) async fn run_queries(
|| candidate
.chunks
.iter()
.any(|chunk| expected_chunk_ids_set.contains(&chunk.chunk.get_id()))
.any(|chunk| expected_chunk_ids_set.contains(&chunk.chunk.id()))
} else {
true
};
+6 -6
View File
@@ -194,7 +194,7 @@ impl EvaluationCandidate {
fn from_entity(entity: RetrievedEntity) -> Self {
let entity_category = Some(format!("{:?}", entity.entity.entity_type));
Self {
entity_id: entity.entity.get_id().to_string(),
entity_id: entity.entity.id().to_string(),
source_id: entity.entity.source_id.clone(),
entity_name: entity.entity.name.clone(),
entity_description: Some(entity.entity.description.clone()),
@@ -207,7 +207,7 @@ impl EvaluationCandidate {
fn from_chunk(chunk: RetrievedChunk) -> Self {
let snippet = chunk_snippet(&chunk.chunk.chunk);
Self {
entity_id: chunk.chunk.get_id().to_string(),
entity_id: chunk.chunk.id().to_string(),
source_id: chunk.chunk.source_id.clone(),
entity_name: chunk.chunk.source_id.clone(),
entity_description: Some(snippet),
@@ -423,11 +423,11 @@ pub fn build_case_diagnostics(
let mut chunk_entries = Vec::new();
for chunk in &candidate.chunks {
let contains_answer = text_contains_answer(&chunk.chunk.chunk, answers_lower);
let expected_chunk = expected_set.contains(chunk.chunk.get_id());
seen_chunks.insert(chunk.chunk.get_id().to_string());
attached_chunk_ids.push(chunk.chunk.get_id().to_string());
let expected_chunk = expected_set.contains(chunk.chunk.id());
seen_chunks.insert(chunk.chunk.id().to_string());
attached_chunk_ids.push(chunk.chunk.id().to_string());
chunk_entries.push(ChunkDiagnosticsEntry {
chunk_id: chunk.chunk.get_id().to_string(),
chunk_id: chunk.chunk.id().to_string(),
score: chunk.score,
contains_answer,
expected_chunk,