Skip to content

Commit 1fc0c19

Browse files
fix: display, use settings instead of state for api endpoint (#632)
* fix: display, use settings instead of state for api endpoint * Fix flaky test for fs create tool by sync'ing data
1 parent 37c0de8 commit 1fc0c19

File tree

14 files changed

+77
-47
lines changed

14 files changed

+77
-47
lines changed

crates/amzn-codewhisperer-client/src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,8 @@ impl Builder {
11201120
/// # Examples
11211121
///
11221122
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1123-
/// `behavior-version-latest` cargo feature. ```no_run
1123+
/// `behavior-version-latest` cargo feature.
1124+
/// ```no_run
11241125
/// use amzn_codewhisperer_client::config::BehaviorVersion;
11251126
///
11261127
/// let config = amzn_codewhisperer_client::Config::builder()
@@ -1129,7 +1130,7 @@ impl Builder {
11291130
/// .build();
11301131
/// let client = amzn_codewhisperer_client::Client::from_conf(config);
11311132
/// ```
1132-
///
1133+
///
11331134
/// Customizing behavior major version:
11341135
/// ```no_run
11351136
/// use amzn_codewhisperer_client::config::BehaviorVersion;
@@ -1155,7 +1156,8 @@ impl Builder {
11551156
/// # Examples
11561157
///
11571158
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1158-
/// `behavior-version-latest` cargo feature. ```no_run
1159+
/// `behavior-version-latest` cargo feature.
1160+
/// ```no_run
11591161
/// use amzn_codewhisperer_client::config::BehaviorVersion;
11601162
///
11611163
/// let config = amzn_codewhisperer_client::Config::builder()
@@ -1164,7 +1166,7 @@ impl Builder {
11641166
/// .build();
11651167
/// let client = amzn_codewhisperer_client::Client::from_conf(config);
11661168
/// ```
1167-
///
1169+
///
11681170
/// Customizing behavior major version:
11691171
/// ```no_run
11701172
/// use amzn_codewhisperer_client::config::BehaviorVersion;

crates/amzn-codewhisperer-streaming-client/src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,8 @@ impl Builder {
11021102
/// # Examples
11031103
///
11041104
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1105-
/// `behavior-version-latest` cargo feature. ```no_run
1105+
/// `behavior-version-latest` cargo feature.
1106+
/// ```no_run
11061107
/// use amzn_codewhisperer_streaming_client::config::BehaviorVersion;
11071108
///
11081109
/// let config = amzn_codewhisperer_streaming_client::Config::builder()
@@ -1111,7 +1112,7 @@ impl Builder {
11111112
/// .build();
11121113
/// let client = amzn_codewhisperer_streaming_client::Client::from_conf(config);
11131114
/// ```
1114-
///
1115+
///
11151116
/// Customizing behavior major version:
11161117
/// ```no_run
11171118
/// use amzn_codewhisperer_streaming_client::config::BehaviorVersion;
@@ -1137,7 +1138,8 @@ impl Builder {
11371138
/// # Examples
11381139
///
11391140
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1140-
/// `behavior-version-latest` cargo feature. ```no_run
1141+
/// `behavior-version-latest` cargo feature.
1142+
/// ```no_run
11411143
/// use amzn_codewhisperer_streaming_client::config::BehaviorVersion;
11421144
///
11431145
/// let config = amzn_codewhisperer_streaming_client::Config::builder()
@@ -1146,7 +1148,7 @@ impl Builder {
11461148
/// .build();
11471149
/// let client = amzn_codewhisperer_streaming_client::Client::from_conf(config);
11481150
/// ```
1149-
///
1151+
///
11501152
/// Customizing behavior major version:
11511153
/// ```no_run
11521154
/// use amzn_codewhisperer_streaming_client::config::BehaviorVersion;

crates/amzn-consolas-client/src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,8 @@ impl Builder {
11351135
/// # Examples
11361136
///
11371137
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1138-
/// `behavior-version-latest` cargo feature. ```no_run
1138+
/// `behavior-version-latest` cargo feature.
1139+
/// ```no_run
11391140
/// use amzn_consolas_client::config::BehaviorVersion;
11401141
///
11411142
/// let config = amzn_consolas_client::Config::builder()
@@ -1144,7 +1145,7 @@ impl Builder {
11441145
/// .build();
11451146
/// let client = amzn_consolas_client::Client::from_conf(config);
11461147
/// ```
1147-
///
1148+
///
11481149
/// Customizing behavior major version:
11491150
/// ```no_run
11501151
/// use amzn_consolas_client::config::BehaviorVersion;
@@ -1170,7 +1171,8 @@ impl Builder {
11701171
/// # Examples
11711172
///
11721173
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1173-
/// `behavior-version-latest` cargo feature. ```no_run
1174+
/// `behavior-version-latest` cargo feature.
1175+
/// ```no_run
11741176
/// use amzn_consolas_client::config::BehaviorVersion;
11751177
///
11761178
/// let config = amzn_consolas_client::Config::builder()
@@ -1179,7 +1181,7 @@ impl Builder {
11791181
/// .build();
11801182
/// let client = amzn_consolas_client::Client::from_conf(config);
11811183
/// ```
1182-
///
1184+
///
11831185
/// Customizing behavior major version:
11841186
/// ```no_run
11851187
/// use amzn_consolas_client::config::BehaviorVersion;

crates/amzn-qdeveloper-client/src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,8 @@ impl Builder {
11351135
/// # Examples
11361136
///
11371137
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1138-
/// `behavior-version-latest` cargo feature. ```no_run
1138+
/// `behavior-version-latest` cargo feature.
1139+
/// ```no_run
11391140
/// use amzn_qdeveloper_client::config::BehaviorVersion;
11401141
///
11411142
/// let config = amzn_qdeveloper_client::Config::builder()
@@ -1144,7 +1145,7 @@ impl Builder {
11441145
/// .build();
11451146
/// let client = amzn_qdeveloper_client::Client::from_conf(config);
11461147
/// ```
1147-
///
1148+
///
11481149
/// Customizing behavior major version:
11491150
/// ```no_run
11501151
/// use amzn_qdeveloper_client::config::BehaviorVersion;
@@ -1170,7 +1171,8 @@ impl Builder {
11701171
/// # Examples
11711172
///
11721173
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1173-
/// `behavior-version-latest` cargo feature. ```no_run
1174+
/// `behavior-version-latest` cargo feature.
1175+
/// ```no_run
11741176
/// use amzn_qdeveloper_client::config::BehaviorVersion;
11751177
///
11761178
/// let config = amzn_qdeveloper_client::Config::builder()
@@ -1179,7 +1181,7 @@ impl Builder {
11791181
/// .build();
11801182
/// let client = amzn_qdeveloper_client::Client::from_conf(config);
11811183
/// ```
1182-
///
1184+
///
11831185
/// Customizing behavior major version:
11841186
/// ```no_run
11851187
/// use amzn_qdeveloper_client::config::BehaviorVersion;

crates/amzn-qdeveloper-streaming-client/src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,8 @@ impl Builder {
11171117
/// # Examples
11181118
///
11191119
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1120-
/// `behavior-version-latest` cargo feature. ```no_run
1120+
/// `behavior-version-latest` cargo feature.
1121+
/// ```no_run
11211122
/// use amzn_qdeveloper_streaming_client::config::BehaviorVersion;
11221123
///
11231124
/// let config = amzn_qdeveloper_streaming_client::Config::builder()
@@ -1126,7 +1127,7 @@ impl Builder {
11261127
/// .build();
11271128
/// let client = amzn_qdeveloper_streaming_client::Client::from_conf(config);
11281129
/// ```
1129-
///
1130+
///
11301131
/// Customizing behavior major version:
11311132
/// ```no_run
11321133
/// use amzn_qdeveloper_streaming_client::config::BehaviorVersion;
@@ -1152,7 +1153,8 @@ impl Builder {
11521153
/// # Examples
11531154
///
11541155
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1155-
/// `behavior-version-latest` cargo feature. ```no_run
1156+
/// `behavior-version-latest` cargo feature.
1157+
/// ```no_run
11561158
/// use amzn_qdeveloper_streaming_client::config::BehaviorVersion;
11571159
///
11581160
/// let config = amzn_qdeveloper_streaming_client::Config::builder()
@@ -1161,7 +1163,7 @@ impl Builder {
11611163
/// .build();
11621164
/// let client = amzn_qdeveloper_streaming_client::Client::from_conf(config);
11631165
/// ```
1164-
///
1166+
///
11651167
/// Customizing behavior major version:
11661168
/// ```no_run
11671169
/// use amzn_qdeveloper_streaming_client::config::BehaviorVersion;

crates/amzn-toolkit-telemetry/src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,8 @@ impl Builder {
10551055
/// # Examples
10561056
///
10571057
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1058-
/// `behavior-version-latest` cargo feature. ```no_run
1058+
/// `behavior-version-latest` cargo feature.
1059+
/// ```no_run
10591060
/// use amzn_toolkit_telemetry::config::BehaviorVersion;
10601061
///
10611062
/// let config = amzn_toolkit_telemetry::Config::builder()
@@ -1064,7 +1065,7 @@ impl Builder {
10641065
/// .build();
10651066
/// let client = amzn_toolkit_telemetry::Client::from_conf(config);
10661067
/// ```
1067-
///
1068+
///
10681069
/// Customizing behavior major version:
10691070
/// ```no_run
10701071
/// use amzn_toolkit_telemetry::config::BehaviorVersion;
@@ -1090,7 +1091,8 @@ impl Builder {
10901091
/// # Examples
10911092
///
10921093
/// Set the behavior major version to `latest`. This is equivalent to enabling the
1093-
/// `behavior-version-latest` cargo feature. ```no_run
1094+
/// `behavior-version-latest` cargo feature.
1095+
/// ```no_run
10941096
/// use amzn_toolkit_telemetry::config::BehaviorVersion;
10951097
///
10961098
/// let config = amzn_toolkit_telemetry::Config::builder()
@@ -1099,7 +1101,7 @@ impl Builder {
10991101
/// .build();
11001102
/// let client = amzn_toolkit_telemetry::Client::from_conf(config);
11011103
/// ```
1102-
///
1104+
///
11031105
/// Customizing behavior major version:
11041106
/// ```no_run
11051107
/// use amzn_toolkit_telemetry::config::BehaviorVersion;

crates/fig_api_client/src/endpoints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Endpoint {
2727
};
2828

2929
pub fn load_codewhisperer() -> Self {
30-
match fig_settings::state::get_value("api.codewhisperer.service") {
30+
match fig_settings::settings::get_value("api.codewhisperer.service") {
3131
Ok(Some(Value::Object(o))) => {
3232
let endpoint = o.get("endpoint").and_then(|v| v.as_str());
3333
let region = o.get("region").and_then(|v| v.as_str());
@@ -45,7 +45,7 @@ impl Endpoint {
4545
}
4646

4747
pub fn load_q() -> Self {
48-
match fig_settings::state::get_value("api.q.service") {
48+
match fig_settings::settings::get_value("api.q.service") {
4949
Ok(Some(Value::Object(o))) => {
5050
let endpoint = o.get("endpoint").and_then(|v| v.as_str());
5151
let region = o.get("region").and_then(|v| v.as_str());

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
264264
<em>@history</em> to pass your shell history
265265
<em>@git</em> to pass information about your current git repository
266266
<em>@env</em> to pass your shell environment
267+
267268
"
268269
})
269270
)?;
@@ -491,10 +492,11 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
491492
queue!(self.output, cursor::MoveToNextLine(1))?;
492493
}
493494
queue!(self.output, style::Print("─".repeat(terminal_width)))?;
495+
execute!(self.output, style::Print("\n"))?;
494496
execute!(
495497
self.output,
496498
style::Print(
497-
"Press `c` to consent to running these tools, or anything else to continue your conversation.\n"
499+
"Press `c` to consent to running these tools, or anything else to continue your conversation.\n\n"
498500
),
499501
)?;
500502
}
@@ -575,14 +577,14 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
575577
}
576578
queue!(self.output, style::SetForegroundColor(Color::Reset))?;
577579
queue!(self.output, cursor::Hide)?;
578-
self.spinner = Some(Spinner::new(Spinners::Dots, "Generating your answer...".to_owned()));
579580
tokio::spawn(async {
580581
tokio::signal::ctrl_c().await.unwrap();
581582
execute!(std::io::stdout(), cursor::Show).unwrap();
582583
#[allow(clippy::exit)]
583584
std::process::exit(0);
584585
});
585586
execute!(self.output, style::Print("\n"))?;
587+
self.spinner = Some(Spinner::new(Spinners::Dots, "Generating your answer...".to_owned()));
586588
}
587589

588590
self.conversation_state.append_new_user_message(user_input).await;

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::fmt::Display;
21
use std::io::Write;
32
use std::process::Stdio;
43

@@ -27,7 +26,7 @@ pub struct ExecuteBash {
2726

2827
impl ExecuteBash {
2928
pub fn display_name() -> String {
30-
"Execute bash command".to_owned()
29+
"Execute Bash".to_owned()
3130
}
3231

3332
pub async fn invoke(&self, mut updates: impl Write) -> Result<InvokeOutput> {
@@ -64,7 +63,10 @@ impl ExecuteBash {
6463
pub fn show_readable_intention(&self, updates: &mut impl Write) -> Result<()> {
6564
Ok(queue!(
6665
updates,
67-
style::Print(format!("Executing bash command: {}\n", self.command))
66+
style::Print("Command: "),
67+
style::SetForegroundColor(Color::Green),
68+
style::Print(&self.command),
69+
style::ResetColor,
6870
)?)
6971
}
7072

@@ -73,18 +75,6 @@ impl ExecuteBash {
7375
}
7476
}
7577

76-
impl Display for ExecuteBash {
77-
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78-
queue!(
79-
std::io::stdout(),
80-
style::Print(format!("Executing bash command: {}\n", self.command))
81-
)
82-
.map_err(|_| std::fmt::Error)?;
83-
84-
Ok(())
85-
}
86-
}
87-
8878
#[cfg(test)]
8979
mod tests {
9080
use super::*;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl FsRead {
4444
}
4545

4646
pub fn display_name() -> String {
47-
"Read from filesystem".to_owned()
47+
"File System Read".to_owned()
4848
}
4949

5050
pub async fn invoke(&self, ctx: &Context, updates: &mut impl Write) -> Result<InvokeOutput> {

0 commit comments

Comments
 (0)