Skip to content

Commit 28ffb2e

Browse files
authored
fix: uses struct discriminates as hash key for native tools (#2470)
1 parent eef7eb0 commit 28ffb2e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crates/chat-cli/src/cli/chat/cli/tools.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl ToolsArgs {
6363
session
6464
.conversation
6565
.tools
66-
.get("native")
66+
.get(&ToolOrigin::Native)
6767
.and_then(|tools| {
6868
tools
6969
.iter()
@@ -221,7 +221,7 @@ impl ToolsSubcommand {
221221
let native_tool_names = session
222222
.conversation
223223
.tools
224-
.get("native")
224+
.get(&ToolOrigin::Native)
225225
.map(|tools| {
226226
tools
227227
.iter()

crates/chat-cli/src/cli/chat/tools/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ pub enum ToolOrigin {
169169

170170
impl std::hash::Hash for ToolOrigin {
171171
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
172+
std::mem::discriminant(self).hash(state);
172173
match self {
173-
Self::Native => "native".hash(state),
174+
Self::Native => {},
174175
Self::McpServer(name) => name.hash(state),
175176
}
176177
}

0 commit comments

Comments
 (0)