87 lines
2.4 KiB
XML
87 lines
2.4 KiB
XML
{% if params_kw.id %}
|
|
{% set llmid = params_kw.id %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"spacing": 10
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Title",
|
|
"options": {
|
|
"text": "模型上线检查",
|
|
"level": 2
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"name": "check_status",
|
|
"text": "检查中...",
|
|
"i18n": false
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"name": "checks_list",
|
|
"spacing": 5
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"name": "test_btn",
|
|
"text": "体验一次",
|
|
"i18n": false,
|
|
"disabled": true
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"name": "test_result",
|
|
"text": "",
|
|
"i18n": false
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"name": "check_charging_btn",
|
|
"text": "检查计费",
|
|
"i18n": false,
|
|
"disabled": true
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"name": "charging_result",
|
|
"text": "",
|
|
"i18n": false
|
|
}
|
|
}
|
|
],
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "load",
|
|
"actiontype": "script",
|
|
"target": "self",
|
|
"script": "var resp = await fetch('{{entire_url('./api/llm_launch_check_api.dspy')}}?llmid={{llmid}}&action=check'); var data = await resp.json(); var statusEl = this.getWidgetByName('check_status'); var listEl = this.getWidgetByName('checks_list'); if(data.error) { statusEl.set_text('错误: ' + data.error); return; } var html = ''; var allOk = true; (data.checks||[]).forEach(function(c){ var icon = c.passed ? '✅' : '❌'; if(!c.passed) allOk = false; html += '<div style=\"padding:4px 0\">' + icon + ' <b>' + c.name + '</b>: ' + (c.detail||'') + '</div>'; }); if(listEl && listEl.dom_element) listEl.dom_element.innerHTML = html; if(allOk) { statusEl.set_text('全部通过 ✅'); var testBtn = this.getWidgetByName('test_btn'); if(testBtn) { testBtn.dom_element.disabled = false; testBtn.dom_element.onclick = async function(){ var r2 = await fetch('{{entire_url('./api/llm_launch_check_api.dspy')}}?llmid={{llmid}}&action=inference'); var d2 = await r2.json(); var tr = this.getWidgetByName('test_result'); if(d2.success) tr.set_text('回复: ' + d2.response); else tr.set_text('失败: ' + d2.error); }.bind(this); } } else { statusEl.set_text('存在问题 ❌ 请检查下方详情'); }"
|
|
}
|
|
]
|
|
}
|
|
{% else %}
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "缺少模型ID参数",
|
|
"i18n": true
|
|
}
|
|
}
|
|
{% endif %}
|