diff --git a/wwwroot/new_session.ui b/wwwroot/new_session.ui index 20d5ed8..b7a6673 100644 --- a/wwwroot/new_session.ui +++ b/wwwroot/new_session.ui @@ -25,7 +25,7 @@ "maxWidth": "600px", "fields": [ { - "widgettype": "UiStr", + "uitype": "str", "name": "session-name", "label": "Session Name", "placeholder": "Enter session name...", @@ -33,7 +33,7 @@ "marginBottom": "16px" }, { - "widgettype": "UiStr", + "uitype": "str", "name": "model-select", "label": "AI Model", "placeholder": "Enter model name or ID...", @@ -41,7 +41,7 @@ "marginBottom": "16px" }, { - "widgettype": "UiText", + "uitype": "text", "name": "initial-prompt", "label": "Initial Prompt (Optional)", "placeholder": "Enter initial context or instructions...", @@ -49,59 +49,52 @@ "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": [ + ], + "toolbar": { + "tools": [ { - "wid": "self", - "event": "click", - "actiontype": "urlwidget", - "target": "app.main-content", - "options": { - "url": "{{entire_url('index.ui')}}" - }, - "mode": "replace" + "label": "Create Session", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "10px 20px", + "fontWeight": "600", + "action": "create_session" + }, + { + "label": "Cancel", + "bgcolor": "#64748B", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "10px 20px", + "action": "cancel" } ] } + }, + "binds": [ + { + "wid": "self", + "event": "create_session", + "actiontype": "registerfunction", + "target": "app.new-session-container", + "rfname": "create_session", + "params": { + "form_data": "{{ 'new-session-form'.data }}" + } + }, + { + "wid": "self", + "event": "cancel", + "actiontype": "urlwidget", + "target": "app.main-content", + "options": { + "url": "{{entire_url('index.ui')}}" + }, + "mode": "replace" + } ] } ]