Skip to content

Commit 379408b

Browse files
authored
feat(tools): display chat settings in report_issue (#994)
- record if `accept_all` or `interactive` is true/false - display list of all available profiles
1 parent 28eb00c commit 379408b

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,8 @@ where
14251425
context_manager: self.conversation_state.context_manager.clone(),
14261426
transcript: self.conversation_state.transcript.clone(),
14271427
failed_request_ids: self.failed_request_ids.clone(),
1428+
accept_all: self.accept_all,
1429+
interactive: self.interactive,
14281430
});
14291431
},
14301432
_ => (),

crates/q_cli/src/cli/chat/tools/gh_issue.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub struct GhIssueContext {
3434
pub context_manager: Option<ContextManager>,
3535
pub transcript: VecDeque<String>,
3636
pub failed_request_ids: Vec<String>,
37+
pub accept_all: bool,
38+
pub interactive: bool,
3739
}
3840

3941
/// Max amount of user chat + assistant recent chat messages to include in the issue.
@@ -48,7 +50,12 @@ impl GhIssue {
4850
};
4951

5052
// Prepare additional details from the chat session
51-
let additional_environment = [Self::get_request_ids(context), Self::get_context(context).await].join("\n\n");
53+
let additional_environment = [
54+
Self::get_chat_settings(context),
55+
Self::get_request_ids(context),
56+
Self::get_context(context).await,
57+
]
58+
.join("\n\n");
5259

5360
// Add chat history to the actual behavior text.
5461
let actual_behavior = self.actual_behavior.as_ref().map_or_else(
@@ -124,20 +131,29 @@ impl GhIssue {
124131
return ctx_str;
125132
};
126133

127-
ctx_str.push_str(&format!("current_profile={}\n\n", ctx_manager.current_profile));
134+
ctx_str.push_str(&format!("current_profile={}\n", ctx_manager.current_profile));
135+
match ctx_manager.list_profiles().await {
136+
Ok(profiles) if !profiles.is_empty() => {
137+
ctx_str.push_str(&format!("profiles=\n{}\n\n", profiles.join("\n")));
138+
},
139+
_ => ctx_str.push_str("profiles=none\n\n"),
140+
}
128141

129142
// Context file categories
130143
if ctx_manager.global_config.paths.is_empty() {
131-
ctx_str.push_str("global=none\n\n");
144+
ctx_str.push_str("global_context=none\n\n");
132145
} else {
133-
ctx_str.push_str(&format!("global=\n{}\n\n", &ctx_manager.global_config.paths.join("\n")));
146+
ctx_str.push_str(&format!(
147+
"global_context=\n{}\n\n",
148+
&ctx_manager.global_config.paths.join("\n")
149+
));
134150
}
135151

136152
if ctx_manager.profile_config.paths.is_empty() {
137-
ctx_str.push_str("profile=none\n\n");
153+
ctx_str.push_str("profile_context=none\n\n");
138154
} else {
139155
ctx_str.push_str(&format!(
140-
"profile=\n{}\n\n",
156+
"profile_context=\n{}\n\n",
141157
&ctx_manager.profile_config.paths.join("\n")
142158
));
143159
}
@@ -162,6 +178,14 @@ impl GhIssue {
162178
ctx_str
163179
}
164180

181+
fn get_chat_settings(context: &GhIssueContext) -> String {
182+
let mut result_str = "[chat-settings]\n".to_string();
183+
result_str.push_str(&format!("accept_all={}\n", context.accept_all));
184+
result_str.push_str(&format!("interactive={}", context.interactive));
185+
186+
result_str
187+
}
188+
165189
pub fn queue_description(&self, updates: &mut impl Write) -> Result<()> {
166190
Ok(queue!(
167191
updates,

0 commit comments

Comments
 (0)