fix: test_pricing结果用subwidgets控件数组渲染
- dspy: items改为Text控件数组([{widgettype:Text, options:{text:json}}])
- ui: status_of.ok改为VScrollPanel+subwidgets引用items
- 解决之前返回纯文本字符串无法渲染为bricks控件的问题
This commit is contained in:
parent
bcdb1e02cd
commit
d22dbc57ae
@ -4,19 +4,24 @@ try:
|
||||
if isinstance(data, str):
|
||||
data = json.loads(data)
|
||||
x = await buffered_charging(ppid, data)
|
||||
items = []
|
||||
subwidgets = []
|
||||
if isinstance(x, list):
|
||||
for r in x:
|
||||
items.append(json.dumps(r, ensure_ascii=False))
|
||||
subwidgets.append({
|
||||
"widgettype": "Text",
|
||||
"options": {"text": json.dumps(r, ensure_ascii=False), "width": "100%"}
|
||||
})
|
||||
else:
|
||||
items.append(json.dumps(x, ensure_ascii=False))
|
||||
result_text = '\n\n'.join(items)
|
||||
subwidgets.append({
|
||||
"widgettype": "Text",
|
||||
"options": {"text": json.dumps(x, ensure_ascii=False), "width": "100%"}
|
||||
})
|
||||
return {
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"ppid": ppid,
|
||||
"data": data,
|
||||
"items": result_text
|
||||
"items": subwidgets
|
||||
}
|
||||
}
|
||||
except Exception as e:
|
||||
|
||||
@ -49,11 +49,12 @@
|
||||
},
|
||||
"status_of": {
|
||||
"ok": {
|
||||
"widgettype": "Text",
|
||||
"widgettype": "VScrollPanel",
|
||||
"options":{
|
||||
"width": "100%",
|
||||
"text": "${items}"
|
||||
}
|
||||
"height": "100%"
|
||||
},
|
||||
"subwidgets": "${items}"
|
||||
},
|
||||
"error": {
|
||||
"widgettype": "Text",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user