diff options
| author | sigoden <sigoden@gmail.com> | 2025-01-21 21:45:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-21 21:45:20 +0800 |
| commit | b666fc6bd24a039d2d23a312fa453d0fe3ed79ab (patch) | |
| tree | c19b5c07ca3fba94ed99e2f34b0e96b04d43ba6d /src/rag/mod.rs | |
| parent | e522289b61bbf0d253f03433120ab3222da5e4d3 (diff) | |
| download | aichat-b666fc6bd24a039d2d23a312fa453d0fe3ed79ab.tar.gz | |
refactor: optimize configuration initialization (#1110)
Diffstat (limited to 'src/rag/mod.rs')
| -rw-r--r-- | src/rag/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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<String> { 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<usize> { let default_value = model.default_chunk_size().to_string(); let help_message = model |
