⚙️Config / Metadata
Last updated
Last updated
Every extension has a file at public/chub_meta.yaml that contains extension metadata like its name, description, tags, et cetera. The file in the template (https://github.com/CharHubAI/extension-template/blob/main/public/chub_meta.yaml) is annotated with explanations of each field.
If you would like people to be able to configure your extension, for example, to set the size of a maze, you need to define a config_schema
in your metadata yaml. This will allow the UI to generate a form for it.
If you dislike yaml, you can instead list it as config_schema: '@config.schema.json'
where the file is present in the public
folder. An example schema with at least one example of everything supported is here: https://github.com/CharHubAI/extension-integration-test/blob/main/public/config.schema.json
The schema type is largely based around the JSON Schema specification (2020), with two caveats:
It does not, generally, support "advanced" features of the spec like 'anyOf', external references, field name patterns, et cetera. If you have a use case requiring this level of complexity in configuration, let us know so we can better understand the use case for this and support it.
If you give the "type" as "character_map" and "value_type" as any valid schema, the form will generate to get configuration information of that type for every character in the chat. For example, this is a valid config schema:
Even if you do have a configuration schema, it should be considered as optional, and the implementation of your extension constructor and load function should have handling for both the configuration being null and any given field in the configuration being null or undefined. As an example, here is the config schema for the maze extension:
Despite having 'required' fields, it still needs to handle the edge cases for missing and partial configurations in its constructor: