Files
AFFiNE-Mirror/packages/backend/native/src/llm/mod.rs
T
DarkSky 965f4590ff feat(server): converge legacy compatibility (#15426)
#### PR Dependency Tree


* **PR #15426** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added workspace BYOK profiles with provider/model catalogs, capability
validation, connection probing, credential rotation, reordering, and
secure local leases.
* Added Copilot route options, selectable targets, managed tiers,
explicit profile/model overrides, and improved streaming with tool
callbacks and abort support.
* Added Copilot availability controls to prevent access when the feature
is disabled.
* **Changes**
* Simplified Copilot configuration and removed legacy provider-specific
settings.
* Removed obsolete model, token-cost, transcript strategy, and provider
metadata fields from public responses.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-05 00:40:13 +08:00

54 lines
2.1 KiB
Rust

mod action;
pub(crate) mod byok;
mod contract_schema;
mod core;
mod ffi;
mod prompt_catalog;
pub(crate) mod route;
pub use self::core::{
capability::llm_match_model_capabilities,
model_registry::{llm_match_model_registry, llm_resolve_model_registry_variant},
prompt::{
llm_get_built_in_prompt_spec, llm_list_built_in_prompt_specs, llm_render_built_in_prompt,
llm_render_built_in_session_prompt,
},
request_builder::{
llm_build_canonical_request, llm_build_canonical_structured_request, llm_build_embedding_request,
llm_build_image_request_from_messages, llm_build_rerank_request, llm_infer_prompt_model_conditions,
},
structured_output::{llm_canonical_json_schema_hash, llm_validate_json_schema},
};
pub use action::copilot_action_recipe;
pub use byok::{
ByokCapabilityInput, ByokCatalogModelOutput, ByokCatalogOutput, ByokCatalogProviderOutput, ByokEndpointInput,
ByokLocalLeaseOutput, ByokModelDeclarationInput, ByokModelProbeCheckOutput, ByokModelProbeOutput,
ByokProbeCheckInput, ByokProbeResultOutput, ByokProbeStatusOutput, ByokProfileDefinitionInput, ByokProfileOutput,
ByokValidationOutput, CreateByokLocalLeaseInput, CreateByokLocalLeaseProviderInput, CreateByokProfileInput,
ProbeByokDraftInput, ProbeByokProfileInput, ReorderByokProfilesInput, ReplaceByokProfileInput,
RotateByokCredentialInput, byok_catalog,
};
#[napi_derive::napi(catch_unwind)]
pub fn llm_get_byok_catalog() -> ByokCatalogOutput {
byok_catalog()
}
pub(crate) use byok::{ByokProfileDefinition, validate_definition};
pub use contract_schema::{llm_get_contract_schema, llm_validate_contract};
pub(crate) use ffi::{
LlmDispatchPayload, LlmMiddlewarePayload, LlmRerankDispatchPayload, LlmStructuredDispatchPayload,
};
pub use prompt_catalog::llm_get_built_in_route_options;
pub use route::{
CopilotAccessProjection, CopilotExecuteInput, CopilotManagedTier, CopilotRouteCheckInput, CopilotTargetOverrideInput,
};
pub(crate) fn invalid_arg(message: impl Into<String>) -> napi::Error {
napi::Error::new(napi::Status::InvalidArg, message.into())
}
pub(crate) fn map_json_error(error: serde_json::Error) -> napi::Error {
invalid_arg(error.to_string())
}