Full Web App Generator

class besser.generators.web_app.web_app_generator.WebAppGenerator(model: DomainModel, gui_model: GUIModel, output_dir: str = None, agent_models=None, agent_configs=None, agent_model=None, agent_config=None, agent_config_yamls=None)[source]

Bases: GeneratorInterface

WebAppGenerator is responsible for generating a web application structure based on input B-UML and GUI models. It implements the GeneratorInterface and facilitates the creation of a web application.

Parameters:
  • model (DomainModel) – The B-UML model representing the application’s domain.

  • gui_model (GUIModel) – The GUI model instance containing necessary configurations.

  • output_dir (str, optional) – Directory where generated code will be saved. Defaults to None.

  • agent_models (list, optional) – List of agent models. Each agent is generated into agents/<name>/ under the output directory.

  • agent_configs (dict, optional) – Mapping of agent.name -> config dict, passed per agent to the underlying BAFGenerator.

  • agent_modelDeprecated. Single-agent back-compat shim. Prefer agent_models.

  • agent_configDeprecated. Single-agent back-compat shim. Prefer agent_configs.

_abc_impl = <_abc._abc_data object>
_generate_agent(env)[source]

Generate agent code for every configured agent model.

Each agent is emitted into agents/<slug>/ under the output directory so that multi-agent projects don’t collide.

_generate_backend(env)[source]
_generate_docker_files(env)[source]

Generates Docker-related files for deployment.

Parameters:

env – The Jinja2 environment for template rendering.

_generate_frontend(env)[source]
property agent_config

returns the config of the first agent, if any.

Type:

Deprecated

property agent_model

returns the first agent model, if any.

Type:

Deprecated

generate()[source]

Generates web application code based on the provided B-UML and GUI models. If any agent models are provided, also generates agent code (one per agent).

Returns:

None, but store the generated code in the specified output directory.

besser.generators.web_app.web_app_generator.agent_slug(name) str[source]

Canonical filesystem slug for an agent.

Reused across the web-app generator (agents/<slug>/ directories, docker-compose build contexts) and the GitHub/Render deploy pipeline. Accepts either a string or an object exposing .name.

Filesystem paths, container names, and hostnames are conventionally lowercase. lowercase=True is currently safe_var_name’s default, but we pass it explicitly here to document the requirement and to keep this slug stable if the default ever changes.

besser.generators.web_app.web_app_generator.resolve_intent_recognition_technology(agent_config) str[source]

Read the intent-recognition technology from flat or structured agent config.

Mirrors _resolve_intent_recognition_technology in the GitHub/Render deploy pipeline (github_deploy_api.py) so local Docker builds agree with Render builds on when the classical (PyTorch-based) intent classifier is in play.