108 lines
3.4 KiB
XML
108 lines
3.4 KiB
XML
{
|
|
"widgettype": "VBox",
|
|
"id": "new-session-container",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"padding": "20px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "Create New Session",
|
|
"fontSize": "24px",
|
|
"fontWeight": "bold",
|
|
"color": "#F8FAFC",
|
|
"marginBottom": "20px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Form",
|
|
"id": "new-session-form",
|
|
"options": {
|
|
"width": "100%",
|
|
"maxWidth": "600px",
|
|
"fields": [
|
|
{
|
|
"widgettype": "UiStr",
|
|
"name": "session-name",
|
|
"label": "Session Name",
|
|
"placeholder": "Enter session name...",
|
|
"width": "100%",
|
|
"marginBottom": "16px"
|
|
},
|
|
{
|
|
"widgettype": "UiStr",
|
|
"name": "model-select",
|
|
"label": "AI Model",
|
|
"placeholder": "Enter model name or ID...",
|
|
"width": "100%",
|
|
"marginBottom": "16px"
|
|
},
|
|
{
|
|
"widgettype": "UiText",
|
|
"name": "initial-prompt",
|
|
"label": "Initial Prompt (Optional)",
|
|
"placeholder": "Enter initial context or instructions...",
|
|
"width": "100%",
|
|
"height": "100px",
|
|
"marginBottom": "24px"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"gap": "12px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "Create Session",
|
|
"bgcolor": "#22C55E",
|
|
"color": "#FFFFFF",
|
|
"border": "none",
|
|
"borderRadius": "6px",
|
|
"padding": "10px 20px",
|
|
"fontWeight": "600"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "script",
|
|
"script": "const formData = bricks.getWidgetById('app.new-session-form').getData(); if (!formData['session-name']) { bricks.showMessage('Please enter a session name', 'error'); return; } if (!formData['model-select']) { bricks.showMessage('Please enter an AI model', 'error'); return; } fetch('/hermes-web-cli/sessions/create/', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(formData) }).then(response => response.json()).then(result => { if (result.success) { bricks.showMessage('Session created successfully', 'success'); bricks.getWidgetById('app.main-content').loadURL(bricks.entire_url('sessions.ui')); } else { bricks.showMessage(result.error || 'Failed to create session', 'error'); } }).catch(error => { bricks.showMessage('Network error: ' + error.message, 'error'); });"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "Cancel",
|
|
"bgcolor": "#64748B",
|
|
"color": "#FFFFFF",
|
|
"border": "none",
|
|
"borderRadius": "6px",
|
|
"padding": "10px 20px"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.main-content",
|
|
"options": {
|
|
"url": "{{entire_url('index.ui')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |