mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
(Frontend) Migrate to new /api/v1/web-client/config endpoint (#12479)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: hieptl <hieptl.developer@gmail.com>
This commit is contained in:
@@ -21,6 +21,14 @@ class DefaultWebClientConfigInjector(WebClientConfigInjector):
|
||||
recaptcha_site_key: str | None = None
|
||||
faulty_models: list[str] = Field(default_factory=list)
|
||||
error_message: str | None = None
|
||||
updated_at: datetime = Field(
|
||||
default=datetime.fromisoformat('2026-01-01T00:00:00Z'),
|
||||
description=(
|
||||
'The timestamp when error messages and faulty models were last updated. '
|
||||
'The frontend uses this value to determine whether error messages are '
|
||||
'new and should be displayed. (Default to start of 2026)'
|
||||
),
|
||||
)
|
||||
github_app_slug: str | None = None
|
||||
|
||||
async def get_web_client_config(self) -> WebClientConfig:
|
||||
@@ -37,6 +45,7 @@ class DefaultWebClientConfigInjector(WebClientConfigInjector):
|
||||
recaptcha_site_key=self.recaptcha_site_key,
|
||||
faulty_models=self.faulty_models,
|
||||
error_message=self.error_message,
|
||||
updated_at=self.updated_at,
|
||||
github_app_slug=self.github_app_slug,
|
||||
)
|
||||
return result
|
||||
|
||||
@@ -25,4 +25,5 @@ class WebClientConfig(DiscriminatedUnionMixin):
|
||||
recaptcha_site_key: str | None
|
||||
faulty_models: list[str]
|
||||
error_message: str | None
|
||||
updated_at: datetime
|
||||
github_app_slug: str | None
|
||||
|
||||
@@ -8,9 +8,12 @@ router = APIRouter(prefix='/web-client', tags=['Config'])
|
||||
|
||||
@router.get('/config')
|
||||
async def get_web_client_config() -> WebClientConfig:
|
||||
"""Get the configuration of the web client. This endpoint is typically one of the first
|
||||
invoked, and does not require authentication. It provides general settings for the
|
||||
web client independent of users."""
|
||||
"""Get the configuration of the web client.
|
||||
|
||||
This endpoint is typically one of the first invoked, and does not require
|
||||
authentication. It provides general settings for the web client independent
|
||||
of users.
|
||||
"""
|
||||
config = get_global_config()
|
||||
result = await config.web_client.get_web_client_config()
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user