summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-23 07:17:26 +0800
committerGitHub <noreply@github.com>2024-06-23 07:17:26 +0800
commit6d148c9c53cd4ac7849f52b956aba87e84cc3d4d (patch)
tree4434dd21d5f6a4e70ab8d9b018948f8b9be69c5a /src/utils
parent590c525048152345cfd6fc5e4e093e9af32a2a73 (diff)
downloadaichat-6d148c9c53cd4ac7849f52b956aba87e84cc3d4d.tar.gz
refactor: embedding model add price and dimension (#636)
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/prompt_input.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/prompt_input.rs b/src/utils/prompt_input.rs
index e887b9f..26343a2 100644
--- a/src/utils/prompt_input.rs
+++ b/src/utils/prompt_input.rs
@@ -54,3 +54,21 @@ fn validate_integer(text: &str) -> Validation {
Validation::Valid
}
}
+
+#[derive(Debug)]
+pub struct SelectOption {
+ pub value: String,
+ pub description: String,
+}
+
+impl SelectOption {
+ pub fn new(value: String, description: String) -> Self {
+ Self { value, description }
+ }
+}
+
+impl std::fmt::Display for SelectOption {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{} ({})", self.value, self.description)
+ }
+}