perf(会员): 模型权限解析改用只读 procedure,去掉热路径写库读
- api-server llm/model_access.rs 改调 get_profile_agc_model_access,不再走带账期刷新的 get_profile_recharge_center - 失败关闭语义不变:procedure 失败或档位目录缺行仍按 Basic
This commit is contained in:
@@ -17,8 +17,8 @@ pub(crate) struct OwnerAgcModelCatalog {
|
||||
|
||||
/// 解析账号的 AGC 模型权限档。
|
||||
///
|
||||
/// 走现有 `get_profile_recharge_center` 读模型(它同时返回会员行与档位目录行);
|
||||
/// 该读带幂等的账期刷新写入,后续可替换为更轻的专用读。
|
||||
/// 走专用只读 procedure `get_profile_agc_model_access`:它只读会员账期投影与档位目录,
|
||||
/// 不触发换期 / 免费点刷新,适合 LLM 代理热路径。
|
||||
pub(crate) async fn resolve_owner_agc_model_access(
|
||||
state: &AppState,
|
||||
owner_user_id: &str,
|
||||
@@ -34,15 +34,10 @@ pub(crate) async fn resolve_owner_agc_model_access(
|
||||
}
|
||||
match state
|
||||
.spacetime_client()
|
||||
.get_profile_recharge_center(owner_user_id.to_string())
|
||||
.get_profile_agc_model_access(owner_user_id.to_string())
|
||||
.await
|
||||
{
|
||||
Ok(center) => center
|
||||
.membership_plans
|
||||
.iter()
|
||||
.find(|row| row.plan == center.membership.plan)
|
||||
.map(|row| AgcModelAccess::from(row.model_access))
|
||||
.unwrap_or(AgcModelAccess::Basic),
|
||||
Ok(record) => AgcModelAccess::from(record.model_access),
|
||||
Err(error) => {
|
||||
tracing::warn!(
|
||||
user_id = %owner_user_id,
|
||||
|
||||
Reference in New Issue
Block a user