fix: add bricks.app as second arg to getWidgetById calls in cockpit scripts
The new bricks.js getWidgetById (line 2680) no longer has a default from_widget fallback. When called without a second argument, from_widget is undefined and get_by_id crashes at line 2691: Cannot read properties of undefined (reading 'dom_element'). Fixed both in refresh button click handler and TextFiles inputed handler.
This commit is contained in:
parent
163824870b
commit
b2314fd3b2
@ -24,7 +24,7 @@
|
||||
"options": { "name": "refresh", "label": "刷新", "css": "small" },
|
||||
"binds": [{
|
||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
||||
"script": "var c=bricks.getWidgetById('chat_scroll');if(c)c.render({});var s=bricks.getWidgetById('stats_row');if(s)s.render({});"
|
||||
"script": "var c=bricks.getWidgetById('chat_scroll',bricks.app);if(c)c.render({});var s=bricks.getWidgetById('stats_row',bricks.app);if(s)s.render({});"
|
||||
}]
|
||||
}
|
||||
]
|
||||
@ -98,7 +98,7 @@
|
||||
"event": "inputed",
|
||||
"actiontype": "script",
|
||||
"target": "self",
|
||||
"script": "var prompt=params.prompt;var files=params.add_files||[];var iid='';try{var iter=bricks.getWidgetById('current_iteration_id');if(iter)iid=iter.options.value||'';}catch(e){}var body='message_text='+encodeURIComponent(prompt)+'&iteration_id='+encodeURIComponent(iid)+'&action=send_message&file_paths='+encodeURIComponent(JSON.stringify(files.map(function(f){return f.name||f})));fetch('/pipeline-sdlc/api/cockpit_chat.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:body}).then(function(r){return r.json()}).then(function(r){if(r.success||r.error){var c=bricks.getWidgetById('chat_scroll');if(c)c.render({});}});"
|
||||
"script": "var prompt=params.prompt;var files=params.add_files||[];var iid='';try{var iter=bricks.getWidgetById('current_iteration_id',bricks.app);if(iter)iid=iter.options.value||'';}catch(e){}var body='message_text='+encodeURIComponent(prompt)+'&iteration_id='+encodeURIComponent(iid)+'&action=send_message&file_paths='+encodeURIComponent(JSON.stringify(files.map(function(f){return f.name||f})));fetch('/pipeline-sdlc/api/cockpit_chat.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:body}).then(function(r){return r.json()}).then(function(r){if(r.success||r.error){var c=bricks.getWidgetById('chat_scroll',bricks.app);if(c)c.render({});}});"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
"options": { "name": "refresh", "label": "刷新", "css": "small" },
|
||||
"binds": [{
|
||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
||||
"script": "var c=bricks.getWidgetById('chat_scroll');if(c)c.render({});var s=bricks.getWidgetById('stats_row');if(s)s.render({});"
|
||||
"script": "var c=bricks.getWidgetById('chat_scroll',bricks.app);if(c)c.render({});var s=bricks.getWidgetById('stats_row',bricks.app);if(s)s.render({});"
|
||||
}]
|
||||
}
|
||||
]
|
||||
@ -98,7 +98,7 @@
|
||||
"event": "inputed",
|
||||
"actiontype": "script",
|
||||
"target": "self",
|
||||
"script": "var prompt=params.prompt;var files=params.add_files||[];var iid='';try{var iter=bricks.getWidgetById('current_iteration_id');if(iter)iid=iter.options.value||'';}catch(e){}var body='message_text='+encodeURIComponent(prompt)+'&iteration_id='+encodeURIComponent(iid)+'&action=send_message&file_paths='+encodeURIComponent(JSON.stringify(files.map(function(f){return f.name||f})));fetch('/pipeline-sdlc/api/cockpit_chat.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:body}).then(function(r){return r.json()}).then(function(r){if(r.success||r.error){var c=bricks.getWidgetById('chat_scroll');if(c)c.render({});}});"
|
||||
"script": "var prompt=params.prompt;var files=params.add_files||[];var iid='';try{var iter=bricks.getWidgetById('current_iteration_id',bricks.app);if(iter)iid=iter.options.value||'';}catch(e){}var body='message_text='+encodeURIComponent(prompt)+'&iteration_id='+encodeURIComponent(iid)+'&action=send_message&file_paths='+encodeURIComponent(JSON.stringify(files.map(function(f){return f.name||f})));fetch('/pipeline-sdlc/api/cockpit_chat.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:body}).then(function(r){return r.json()}).then(function(r){if(r.success||r.error){var c=bricks.getWidgetById('chat_scroll',bricks.app);if(c)c.render({});}});"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user