File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1814,17 +1814,21 @@ def sd_process_meta_fields(fields, config):
18141814# json with top-level dict
18151815def sd_parse_meta_field (prompt , config = False ):
18161816 jfields = {}
1817+ kv_dict = {}
18171818 try :
1818- jfields = json .loads (prompt )
1819- except json .JSONDecodeError :
1820- # accept "field":"value",... without {} (also empty strings)
18211819 try :
1822- jfields = json .loads ('{ ' + prompt + ' }' )
1820+ jfields = json .loads (prompt )
18231821 except json .JSONDecodeError :
1824- print ("Warning: couldn't parse meta prompt; it should be valid JSON." )
1825- if not isinstance (jfields , dict ):
1826- jfields = {}
1827- kv_dict = sd_process_meta_fields (jfields .items (), config )
1822+ # accept "field":"value",... without {} (also empty strings)
1823+ try :
1824+ jfields = json .loads ('{ ' + prompt + ' }' )
1825+ except json .JSONDecodeError :
1826+ print ("Warning: couldn't parse meta prompt; it should be valid JSON." )
1827+ if not isinstance (jfields , dict ):
1828+ jfields = {}
1829+ kv_dict = sd_process_meta_fields (jfields .items (), config )
1830+ except Exception :
1831+ pass
18281832 return kv_dict
18291833
18301834
You can’t perform that action at this time.
0 commit comments