@koaning I reviewed the video and also went through the forums and custom interfaces documentation, but I'm still unable to render custom html
output in the UI.
I edited the prodigy.json
by changing false
to true
, but then got an error that said this setting may overlap with my recipe configuration, so I removed it.
"html_template": true,
⚠ Config setting 'html_template' defined in recipe is overwritten by a
different value set in the global or local prodigy.json. This may lead to
unexpected results and potentially changes to the core behavior of the recipe.
If that's surprising, you should probably remove the setting 'html_template'
from your prodigy.json.
After removing it, I am still getting this error:
⚠ Config setting 'html_template' defined in recipe is overwritten by a
different value set in the global or local prodigy.json. This may lead to
unexpected results and potentially changes to the core behavior of the recipe.
If that's surprising, you should probably remove the setting 'html_template'
from your prodigy.json.
✘ Invalid components returned by recipe
'custom-labels-prompt-multi-intent'
config -> html_template str type expected
config -> html_template value is not a valid boolean
{'dataset': 'flow_control_test2', 'view_id': 'blocks', 'config': {'html_template': <Template 'deployment_prompt.html'>, 'blocks': [{'view_id': 'text_input', 'field_id': 'deployment', 'field_label': 'deployment', 'field_rows': 1}, {'view_id': 'text_input', 'field_id': 'prompt', 'field_label': 'prompt', 'field_rows': 2}, {'view_id': 'choice'}, {'view_id': 'text_input', 'field_label': 'user input field'}, {'view_id': 'html', 'html_template': <Template 'deployment_prompt.html'>}], 'choice_style': 'multiple'}, 'stream': <generator object add_options at 0x1278fd6d0>}
I have tried adding the following components to my return statement in my custom recipe:
return {
"dataset": dataset,
"view_id": "blocks",
"config": {"html_template": template, "blocks": blocks, "choice_style": "multiple"},
# "config": {
# "blocks": [
# {"view_id": "choice", "choice_style": "multiple"},
# {"view_id": "html", "html_template": template},
# ]
# },
"stream": stream
# "config": {"blocks": blocks, "choice_style": "multiple"}
}
The last config
line is my original recipe.
Anything I am missing?
Other components of my recipe that I added for html
. I am calling an html
file in my templates
dir:
import jinja2
from jinja2 import Environment, select_autoescape, FileSystemLoader, Markup, PackageLoader
ROWS_WITH_HTML = [
{"view_id": "text_input", "field_id": "deployment", "field_label": "deployment", "field_rows": 1},
{"view_id": "text_input", "field_id": "prompt", "field_label": "prompt", "field_rows": 2},
{"view_id": "choice"},
{
"view_id": "text_input",
"field_label": "user input field"
}
]
blocks = ROWS_WITH_HTML
templateLoader = jinja2.FileSystemLoader(searchpath="path_to_templates")
templateEnv = jinja2.Environment(loader=templateLoader, autoescape=select_autoescape(["html"]))
# env = Environment(loader=FileSystemLoader(searchpath='path_to_templates'))
template = templateEnv.get_template('deployment_prompt.html')
blocks += [{"view_id": "html", "html_template": template}]
Thanks,
Cheyanne