mirror of
https://github.com/openai/codex.git
synced 2026-09-07 15:40:00 +00:00
## What changed - Add the public asynchronous `ModelsCache` contract and cache entry/error types. - Let model providers and `OpenAiModelsManager` accept caller-provided cache implementations while retaining the existing file-backed cache by default. - Treat cache read failures as misses, keep cache write failures non-fatal, and support refreshing an entry's TTL after ETag revalidation. - Continue to prefer an explicitly configured static model catalog over an injected cache. ## Testing - Cover injected cache hits, read and write failures, TTL refreshes, and end-to-end model selection. - Verify that the file-backed implementation satisfies the new cache contract and does not serve expired entries before revalidation. GitOrigin-RevId: eef957a317910b8502a0c20f8fc112f689d5e389
27 lines
798 B
Rust
27 lines
798 B
Rust
pub mod cache;
|
|
pub mod collaboration_mode_presets;
|
|
pub(crate) mod config;
|
|
pub mod manager;
|
|
pub mod model_info;
|
|
pub mod model_presets;
|
|
pub mod test_support;
|
|
|
|
pub use codex_protocol::auth::AuthMode;
|
|
pub use config::ModelsManagerConfig;
|
|
|
|
/// Load the bundled model catalog shipped with `codex-models-manager`.
|
|
pub fn bundled_models_response()
|
|
-> std::result::Result<codex_protocol::openai_models::ModelsResponse, serde_json::Error> {
|
|
serde_json::from_str(include_str!("../models.json"))
|
|
}
|
|
|
|
/// Convert the client version string to a whole version string (e.g. "1.2.3-alpha.4" -> "1.2.3").
|
|
pub fn client_version_to_whole() -> String {
|
|
format!(
|
|
"{}.{}.{}",
|
|
env!("CARGO_PKG_VERSION_MAJOR"),
|
|
env!("CARGO_PKG_VERSION_MINOR"),
|
|
env!("CARGO_PKG_VERSION_PATCH")
|
|
)
|
|
}
|