mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: simplify account self-check config
This commit is contained in:
@@ -87,6 +87,8 @@ mod tests {
|
||||
assert!(service.supports_quota_refresh("codex"));
|
||||
assert!(service.supports_quota_refresh("antigravity"));
|
||||
assert!(!service.supports_quota_refresh("gemini_cli"));
|
||||
assert!(service.supports_account_self_check("codex"));
|
||||
assert!(!service.supports_account_self_check("gemini_cli"));
|
||||
assert_eq!(
|
||||
service.quota_refresh_unsupported_message("claude_code"),
|
||||
"Claude Code 暂不支持自动刷新额度:上游没有稳定可用的账号额度查询接口"
|
||||
|
||||
@@ -53,6 +53,21 @@ pub trait ProviderPoolAdapter: Send + Sync {
|
||||
"找不到有效端点".to_string()
|
||||
}
|
||||
|
||||
fn supports_account_self_check(&self) -> bool {
|
||||
self.supports_quota_refresh()
|
||||
}
|
||||
|
||||
fn account_self_check_endpoint(
|
||||
&self,
|
||||
endpoints: &[StoredProviderCatalogEndpoint],
|
||||
include_inactive: bool,
|
||||
) -> Option<StoredProviderCatalogEndpoint> {
|
||||
if !self.supports_account_self_check() {
|
||||
return None;
|
||||
}
|
||||
self.quota_refresh_endpoint(endpoints, include_inactive)
|
||||
}
|
||||
|
||||
fn normalize_plan_tier(&self, value: &str) -> Option<String> {
|
||||
normalize_provider_plan_tier(value, self.provider_type())
|
||||
}
|
||||
|
||||
@@ -104,6 +104,20 @@ impl ProviderPoolService {
|
||||
.quota_refresh_missing_endpoint_message()
|
||||
}
|
||||
|
||||
pub fn supports_account_self_check(&self, provider_type: &str) -> bool {
|
||||
self.adapter(provider_type).supports_account_self_check()
|
||||
}
|
||||
|
||||
pub fn account_self_check_endpoint_for_provider(
|
||||
&self,
|
||||
provider_type: &str,
|
||||
endpoints: &[StoredProviderCatalogEndpoint],
|
||||
include_inactive: bool,
|
||||
) -> Option<StoredProviderCatalogEndpoint> {
|
||||
self.adapter(provider_type)
|
||||
.account_self_check_endpoint(endpoints, include_inactive)
|
||||
}
|
||||
|
||||
pub fn normalize_scheduling_presets(
|
||||
&self,
|
||||
provider_type: &str,
|
||||
|
||||
Reference in New Issue
Block a user