WIP v0.2.0: pannello /endpoint e nomi abbreviati dei modelli (in pausa, non compilato)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use akode_protocol::config_types::Personality;
|
||||
use akode_protocol::openai_models::ModelsResponse;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ModelsManagerConfig {
|
||||
pub model_context_window: Option<i64>,
|
||||
/// Per-model context windows (`[model_providers.<id>.models."<id>"].context_window`),
|
||||
/// keyed by model id; they win over `model_context_window`.
|
||||
pub model_context_windows: HashMap<String, i64>,
|
||||
pub model_auto_compact_token_limit: Option<i64>,
|
||||
pub tool_output_token_limit: Option<usize>,
|
||||
pub base_instructions: Option<String>,
|
||||
|
||||
@@ -18,7 +18,12 @@ pub const BASE_INSTRUCTIONS: &str = include_str!("../prompt.md");
|
||||
const PERSONALITY_SECTION_HEADER: &str = "# Personality";
|
||||
|
||||
pub fn with_config_overrides(mut model: ModelInfo, config: &ModelsManagerConfig) -> ModelInfo {
|
||||
if let Some(context_window) = config.model_context_window {
|
||||
let configured_window = config
|
||||
.model_context_windows
|
||||
.get(&model.slug)
|
||||
.copied()
|
||||
.or(config.model_context_window);
|
||||
if let Some(context_window) = configured_window {
|
||||
model.context_window = Some(
|
||||
model
|
||||
.max_context_window
|
||||
|
||||
Reference in New Issue
Block a user