Add defaultdict import and handle empty custom_fields
This commit is contained in:
parent
c7ad808c9e
commit
1f76ad728f
1 changed files with 4 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException
|
from fastapi import APIRouter, HTTPException
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
|
@ -42,6 +44,8 @@ def post_validate_prompt(prompt_request: ValidatePromptRequest):
|
||||||
input_variables=input_variables,
|
input_variables=input_variables,
|
||||||
frontend_node=None,
|
frontend_node=None,
|
||||||
)
|
)
|
||||||
|
if not prompt_request.custom_fields:
|
||||||
|
prompt_request.custom_fields = defaultdict(list)
|
||||||
old_custom_fields = get_old_custom_fields(
|
old_custom_fields = get_old_custom_fields(
|
||||||
prompt_request.custom_fields, prompt_request.name
|
prompt_request.custom_fields, prompt_request.name
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue