feat(api): Add /api/gui/state endpoint and live_gui integration tests
This commit is contained in:
@@ -707,6 +707,13 @@ class AppController:
|
||||
'manual_approve': 'ui_manual_approve'
|
||||
}
|
||||
|
||||
self._gettable_fields = dict(self._settable_fields)
|
||||
self._gettable_fields.update({
|
||||
'ui_focus_agent': 'ui_focus_agent',
|
||||
'active_discussion': 'active_discussion',
|
||||
'_track_discussion_active': '_track_discussion_active'
|
||||
})
|
||||
|
||||
self.hook_server = api_hooks.HookServer(app if app else self)
|
||||
self.hook_server.start()
|
||||
|
||||
@@ -1004,6 +1011,15 @@ class AppController:
|
||||
"""Returns the health status of the API."""
|
||||
return {"status": "ok"}
|
||||
|
||||
@api.get("/api/gui/state", dependencies=[Depends(get_api_key)])
|
||||
def get_gui_state() -> dict[str, Any]:
|
||||
"""Returns the current GUI state for specific fields."""
|
||||
gettable = getattr(self, "_gettable_fields", {})
|
||||
state = {}
|
||||
for key, attr in gettable.items():
|
||||
state[key] = getattr(self, attr, None)
|
||||
return state
|
||||
|
||||
@api.get("/status", dependencies=[Depends(get_api_key)])
|
||||
def status() -> dict[str, Any]:
|
||||
"""Returns the current status of the application."""
|
||||
|
||||
Reference in New Issue
Block a user