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

Function create_provider_source

astrbot/dashboard/api/providers.py:108–118  ·  view source on GitHub ↗
(
    payload: ProviderSourceRequest,
    _auth: AuthContext = Depends(require_provider_scope),
    service: ProviderConfigService = Depends(get_service),
)

Source from the content-addressed store, hash-verified

106
107@router.post("/provider-sources")
108async def create_provider_source(
109 payload: ProviderSourceRequest,
110 _auth: AuthContext = Depends(require_provider_scope),
111 service: ProviderConfigService = Depends(get_service),
112):
113 config = payload.to_dashboard_config()
114 source_id = config.get("id")
115 if not source_id:
116 raise ValueError("Provider source config must have an 'id' field")
117 await service.upsert_provider_source(source_id, config)
118 return ok(message="更新 provider source 成功")
119
120
121@router.get("/provider-sources/by-id")

Callers

nothing calls this directly

Calls 4

okFunction · 0.90
to_dashboard_configMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected