feat(proxy): WorkBuddyModelProvider 增加 supports 判断
供聚合路由按模型匹配 WorkBuddy 供应商。
This commit is contained in:
parent
fee433d2fc
commit
1a96bcb105
@ -52,6 +52,13 @@ class WorkBuddyModelProvider @Inject constructor(
|
|||||||
prefs.edit().putString(key, id).apply()
|
prefs.edit().putString(key, id).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 该区域是否可能支持此模型(在线/内置列表)。 */
|
||||||
|
fun supports(modelId: String, region: ProviderRegion): Boolean {
|
||||||
|
val want = modelId.trim().lowercase()
|
||||||
|
if (want.isBlank() || want == "auto") return true
|
||||||
|
return models.value.any { it.id.equals(modelId, ignoreCase = true) }
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun refreshFor(region: ProviderRegion): Boolean = withContext(Dispatchers.IO) {
|
suspend fun refreshFor(region: ProviderRegion): Boolean = withContext(Dispatchers.IO) {
|
||||||
val credential = credentialRepository.get(ServiceType.WORKBUDDY, null)
|
val credential = credentialRepository.get(ServiceType.WORKBUDDY, null)
|
||||||
?: return@withContext false
|
?: return@withContext false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user