mirror of
https://github.com/perstarkse/minne.git
synced 2026-06-30 10:01:40 +02:00
chore: improve html-router auth, caching, and analytics while centralizing search labels in common.
small fix
This commit is contained in:
@@ -338,6 +338,8 @@ pub fn get_config() -> Result<AppConfig, ConfigError> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::expect_used)]
|
||||
|
||||
use super::{ParseRetrievalStrategyError, RetrievalStrategy};
|
||||
#[test]
|
||||
fn retrieval_strategy_defaults_to_default() {
|
||||
|
||||
@@ -15,6 +15,7 @@ use crate::{
|
||||
utils::config::AppConfig,
|
||||
};
|
||||
|
||||
#[allow(clippy::module_name_repetitions)]
|
||||
pub use crate::utils::config::{EmbeddingBackend, ParseEmbeddingBackendError};
|
||||
|
||||
/// Wrapper around the chosen embedding backend.
|
||||
@@ -431,6 +432,8 @@ pub async fn generate_embedding_with_params(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::expect_used)]
|
||||
|
||||
use super::{EmbeddingBackend, ParseEmbeddingBackendError};
|
||||
use crate::storage::types::system_settings::SystemSettings;
|
||||
use serde_json::json;
|
||||
|
||||
@@ -29,7 +29,10 @@ pub fn validate_ingest_input(
|
||||
category: &str,
|
||||
file_count: usize,
|
||||
) -> Result<(), IngestValidationError> {
|
||||
let text_field_bytes = content.map(str::len).unwrap_or(0) + ctx.len() + category.len();
|
||||
let content_bytes = content.map_or(0, str::len);
|
||||
let text_field_bytes = content_bytes
|
||||
.saturating_add(ctx.len())
|
||||
.saturating_add(category.len());
|
||||
if text_field_bytes > config.ingest_max_body_bytes {
|
||||
return Err(IngestValidationError::PayloadTooLarge(format!(
|
||||
"request text fields exceed maximum allowed body size of {} bytes",
|
||||
|
||||
Reference in New Issue
Block a user