Skip to content

Commit d303cd7

Browse files
committed
fix
1 parent 1f96c10 commit d303cd7

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

crates/q_chat/src/tool_manager.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,11 @@ impl ToolManager {
496496
let tx = self.loading_status_sender.take();
497497
let display_task = self.loading_display_task.take();
498498
let tool_specs = {
499-
let tool_specs = serde_json::from_str::<HashMap<String, ToolSpec>>(include_str!("tools/tool_index.json"))?;
499+
let mut tool_specs = serde_json::from_str::<HashMap<String, ToolSpec>>(include_str!("tools/tool_index.json"))?;
500+
if !crate::tools::think::Think::is_enabled() {
501+
tool_specs.remove("q_think_tool");
502+
}
503+
500504
Arc::new(Mutex::new(tool_specs))
501505
};
502506
let conversation_id = self.conversation_id.clone();
@@ -671,6 +675,7 @@ impl ToolManager {
671675
"execute_bash" => Tool::ExecuteBash(serde_json::from_value::<ExecuteBash>(value.args).map_err(map_err)?),
672676
"use_aws" => Tool::UseAws(serde_json::from_value::<UseAws>(value.args).map_err(map_err)?),
673677
"report_issue" => Tool::GhIssue(serde_json::from_value::<GhIssue>(value.args).map_err(map_err)?),
678+
"q_think_tool" => Tool::Think(serde_json::from_value::<crate::tools::think::Think>(value.args).map_err(map_err)?),
674679
// Note that this name is namespaced with server_name{DELIMITER}tool_name
675680
name => {
676681
let name = self.tn_map.get(name).map_or(name, String::as_str);

crates/q_chat/src/tools/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Tool {
5555
Tool::UseAws(_) => "use_aws",
5656
Tool::Custom(custom_tool) => &custom_tool.name,
5757
Tool::GhIssue(_) => "gh_issue",
58-
Tool::Think(_) => "model_think_tool",
58+
Tool::Think(_) => "q_think_tool",
5959
}
6060
.to_owned()
6161
}
@@ -69,7 +69,7 @@ impl Tool {
6969
Tool::UseAws(use_aws) => use_aws.requires_acceptance(),
7070
Tool::Custom(_) => true,
7171
Tool::GhIssue(_) => false,
72-
Tool::Think(_) => false,
72+
Tool::Think(_) => true,
7373
}
7474
}
7575

@@ -182,6 +182,7 @@ impl ToolPermissions {
182182
"execute_bash" => "trust read-only commands".dark_grey(),
183183
"use_aws" => "trust read-only commands".dark_grey(),
184184
"report_issue" => "trusted".dark_green().bold(),
185+
"q_think_tool" => "trusted".dark_green().bold(),
185186
_ => "not trusted".dark_grey(),
186187
};
187188

crates/q_chat/src/tools/think.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct Think {
2828

2929
impl Think {
3030
/// Checks if the thinking feature is enabled in settings
31-
pub fn is_think_tool_enabled() -> bool {
31+
pub fn is_enabled() -> bool {
3232
// Default to enabled if setting doesn't exist or can't be read
3333
settings::get_bool_or("chat.enableThinking", true)
3434
}

crates/q_chat/src/tools/tool_index.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@
173173
"required": ["title"]
174174
}
175175
},
176-
"think":{
177-
"name": "think",
176+
"q_think_tool":{
177+
"name": "q_think_tool",
178178
"description": "The Think Tool is an internal reasoning mechanism enabling the model to systematically approach complex tasks by logically breaking them down before responding or acting; use it specifically for multi-step problems requiring step-by-step dependencies, reasoning through multiple constraints, synthesizing results from previous tool calls, planning intricate sequences of actions, troubleshooting complex errors, or making decisions involving multiple trade-offs. Avoid using it for straightforward tasks, basic information retrieval, summaries, always clearly define the reasoning challenge, structure thoughts explicitly, consider multiple perspectives, and summarize key insights before important decisions or complex tool interactions.",
179179
"input_schema": {
180180
"type": "object",

0 commit comments

Comments
 (0)