From b666fc6bd24a039d2d23a312fa453d0fe3ed79ab Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 21 Jan 2025 21:45:20 +0800 Subject: refactor: optimize configuration initialization (#1110) --- src/rag/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/rag') diff --git a/src/rag/mod.rs b/src/rag/mod.rs index 8855f4f..6165969 100644 --- a/src/rag/mod.rs +++ b/src/rag/mod.rs @@ -842,6 +842,24 @@ fn select_embedding_model(models: &[&Model]) -> Result { Ok(result.value) } +#[derive(Debug)] +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) + } +} + fn set_chunk_size(model: &Model) -> Result { let default_value = model.default_chunk_size().to_string(); let help_message = model -- cgit v1.2.3