Improve the chat workspace REST endpoints

This commit is contained in:
Kerollmops 2025-06-10 10:21:34 +02:00
parent bc56087a17
commit e654eddf56
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
5 changed files with 72 additions and 19 deletions

View file

@ -55,7 +55,7 @@ use meilisearch_types::features::{
ChatCompletionSettings, InstanceTogglableFeatures, Network, RuntimeTogglableFeatures,
};
use meilisearch_types::heed::byteorder::BE;
use meilisearch_types::heed::types::{SerdeJson, Str, I128};
use meilisearch_types::heed::types::{DecodeIgnore, SerdeJson, Str, I128};
use meilisearch_types::heed::{self, Database, Env, RoTxn, RwTxn, WithoutTls};
use meilisearch_types::milli::index::IndexEmbeddingConfig;
use meilisearch_types::milli::update::IndexerConfig;
@ -904,6 +904,12 @@ impl IndexScheduler {
self.chat_settings.get(rtxn, uid).map_err(Into::into)
}
/// Return true if chat workspace exists.
pub fn chat_workspace_exists(&self, name: &str) -> Result<bool> {
let rtxn = self.env.read_txn()?;
Ok(self.chat_settings.remap_data_type::<DecodeIgnore>().get(&rtxn, name)?.is_some())
}
pub fn put_chat_settings(
&self,
wtxn: &mut RwTxn,