init
2024-09-19 -- Layer between Reflex frontend and backend services.
Code in this layer is responsible for validating inputs that come from the frontend layer and calling the backend services appropriately. It should also handle errors from the backend, converting them into something that the frontend can understand.
service_interface layer includes: - frontend logic - calling all backend services: - assistant_run - database crud (config, conversation, user, etc.) - basic validation of inputs - anything that can be validated before sending to backend - backend may carry out further validation (where access to database information is required for example) - coordination of backend services that make sense from a frontend perspective - I.e. frontend/reflex layer should only have to make one call (either direct to backend for simple reads) or through this layer for anything more complex. - Cancelling and re-running a request -- might involve a few backend service calls, but not justify whole new backend services
Responsibilities: - Validate inputs that come from frontend layer - Injecting dependencies - Call backend services - Handle errors from backend services - Propagate updates to the frontend/reflex layer
Should NOT be responsible for:
- Any rendering logic (return/apply updates that are handled in the frontend layer)
- State management
- Note: Can rely on protocols that the frontend/reflex layer must implement
- E.g. with run_context() as context: (where that reads/updates some state in the reflex layer)
For additional context, I think the Frontend/reflex layer includes: - all pages - layout - event handlers - components - shared states - NOT any significant logic