Skip to content

Commit 70aac6b

Browse files
authored
fix(context): deduplicate context files (#1279)
1 parent 76a8197 commit 70aac6b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

crates/q_cli/src/cli/chat/context.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ impl ContextManager {
403403
self.collect_context_files(&self.profile_config.paths, &mut context_files, force)
404404
.await?;
405405

406+
context_files.sort_by(|a, b| a.0.cmp(&b.0));
407+
context_files.dedup_by(|a, b| a.0 == b.0);
408+
406409
Ok(context_files)
407410
}
408411

crates/q_cli/src/cli/chat/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,8 +1417,8 @@ where
14171417
style::Print("\n🌍 global:\n"),
14181418
style::SetAttribute(Attribute::Reset),
14191419
)?;
1420-
let mut global_context_files = Vec::new();
1421-
let mut profile_context_files = Vec::new();
1420+
let mut global_context_files = HashSet::new();
1421+
let mut profile_context_files = HashSet::new();
14221422
if context_manager.global_config.paths.is_empty() {
14231423
execute!(
14241424
self.output,

0 commit comments

Comments
 (0)