diff options
| author | sigoden <sigoden@gmail.com> | 2023-03-22 21:02:09 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-22 21:02:09 +0800 |
| commit | f257931b0b7065bfc123f13d30047f8973a7f655 (patch) | |
| tree | c9e40facb3b10a87f5a5ca78b6b2d184e13573f4 /src/config | |
| parent | c36eab543377c52e230d5be08d675b330f59d566 (diff) | |
| download | aichat-f257931b0b7065bfc123f13d30047f8973a7f655.tar.gz | |
fix: mask api_key/organization_id in info text (#93)
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 8b6a6ac..19f21a0 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -7,7 +7,7 @@ use self::message::Message; use self::role::Role; use crate::config::message::num_tokens_from_messages; -use crate::utils::now; +use crate::utils::{mask_text, now}; use anyhow::{anyhow, bail, Context, Result}; use inquire::{Confirm, Text}; @@ -333,7 +333,10 @@ impl Config { .map(|v| v.to_string()) .unwrap_or("-".into()); let (api_key, organization_id) = self.get_api_key(); - let organization_id = organization_id.unwrap_or("-".into()); + let api_key = mask_text(&api_key, 3, 4); + let organization_id = organization_id + .map(|v| mask_text(&v, 3, 4)) + .unwrap_or("-".into()); let items = vec