MCPcopy
hub / github.com/AstrBotDevs/AstrBot / update_dashboard_alias_provider

Function update_dashboard_alias_provider

astrbot/dashboard/api/providers.py:460–479  ·  view source on GitHub ↗
(
    request: Request,
    _auth: AuthContext = Depends(require_provider_scope),
    service: ProviderConfigService = Depends(get_service),
)

Source from the content-addressed store, hash-verified

458
459@legacy_router.post("/provider/update")
460async def update_dashboard_alias_provider(
461 request: Request,
462 _auth: AuthContext = Depends(require_provider_scope),
463 service: ProviderConfigService = Depends(get_service),
464):
465 body = await _json_or_empty(request)
466 provider_id = body.get("id")
467 config = body.get("config")
468 if not provider_id or not isinstance(config, dict):
469 return _alias_error("参数错误")
470 try:
471 await service.update_provider(
472 str(provider_id),
473 ProviderConfigRequest(config=config).to_dashboard_config(
474 fallback_id=str(provider_id),
475 ),
476 )
477 return ok(message="更新成功,已经实时生效~")
478 except ValueError as exc:
479 return _alias_error(str(exc))
480
481
482@legacy_router.post("/provider/delete")

Callers

nothing calls this directly

Calls 7

okFunction · 0.90
_json_or_emptyFunction · 0.70
_alias_errorFunction · 0.70
getMethod · 0.45
update_providerMethod · 0.45
to_dashboard_configMethod · 0.45

Tested by

no test coverage detected