diff --git a/scripts/main.dspy b/scripts/main.dspy new file mode 100644 index 0000000..48ca0f4 --- /dev/null +++ b/scripts/main.dspy @@ -0,0 +1,169 @@ +def create_session(): + session_name = request.form.get('session-name', '').strip() + model = request.form.get('model-select', '') + initial_prompt = request.form.get('initial-prompt', '') + + if not session_name: + return {"error": "Session name is required"} + + session_id = generate_session_id() + session_data = { + 'id': session_id, + 'name': session_name, + 'model': model, + 'initial_prompt': initial_prompt, + 'created_at': get_current_timestamp(), + 'last_active': get_current_timestamp() + } + + save_session(session_data) + return {"redirect": f"session_{session_id}.ui"} + +def filter_sessions(): + search_term = request.form.get('session-search', '').lower() + all_sessions = get_all_sessions() + + if search_term: + filtered_sessions = [ + session for session in all_sessions + if search_term in session['name'].lower() or + search_term in session['model'].lower() + ] + else: + filtered_sessions = all_sessions + + return {"sessions": filtered_sessions} + +def open_session(): + session_id = request.form.get('item.id') + if session_id: + session_data = get_session_by_id(session_id) + if session_data: + return {"redirect": f"session_{session_id}.ui"} + + return {"error": "Session not found"} + +def filter_services(): + search_term = request.form.get('service-search', '').lower() + all_services = get_all_services() + + if search_term: + filtered_services = [ + service for service in all_services + if search_term in service['name'].lower() or + search_term in service['endpoint'].lower() + ] + else: + filtered_services = all_services + + return {"services": filtered_services} + +def add_service(): + return {"redirect": "add_service.ui"} + +def edit_service(): + service_id = request.form.get('item.id') + if service_id: + service_data = get_service_by_id(service_id) + if service_data: + return {"redirect": f"edit_service_{service_id}.ui"} + + return {"error": "Service not found"} + +def remove_service(): + service_id = request.form.get('item.id') + if service_id: + delete_service(service_id) + return {"success": True, "message": "Service removed successfully"} + + return {"error": "Service not found"} + +def test_service_connection(): + service_id = request.form.get('item.id') + if service_id: + service_data = get_service_by_id(service_id) + if service_data: + is_connected = test_connection(service_data['endpoint']) + return {"status": "Connected" if is_connected else "Disconnected"} + + return {"error": "Service not found"} + +def save_general_settings(): + default_model = request.form.get('default-model', '') + session_timeout = request.form.get('session-timeout', '30') + auto_save = request.form.get('auto-save', 'false') == 'true' + + settings = { + 'default_model': default_model, + 'session_timeout': int(session_timeout), + 'auto_save': auto_save + } + + save_settings('general', settings) + return {"success": True, "message": "General settings saved successfully"} + +def save_security_settings(): + require_auth = request.form.get('require-auth', 'false') == 'true' + encrypt_storage = request.form.get('encrypt-storage', 'false') == 'true' + + settings = { + 'require_auth': require_auth, + 'encrypt_storage': encrypt_storage + } + + save_settings('security', settings) + return {"success": True, "message": "Security settings saved successfully"} + +def save_appearance_settings(): + theme = request.form.get('theme-select', 'dark') + + settings = { + 'theme': theme + } + + save_settings('appearance', settings) + return {"success": True, "message": "Appearance settings saved successfully"} + +def add_model(): + return {"redirect": "add_model.ui"} + +# Helper function stubs - these would be provided by the framework +def generate_session_id(): + # Framework-provided function + pass + +def get_current_timestamp(): + # Framework-provided function + pass + +def save_session(session_data): + # Framework-provided function + pass + +def get_all_sessions(): + # Framework-provided function + return [] + +def get_session_by_id(session_id): + # Framework-provided function + return None + +def get_all_services(): + # Framework-provided function + return [] + +def get_service_by_id(service_id): + # Framework-provided function + return None + +def delete_service(service_id): + # Framework-provided function + pass + +def test_connection(endpoint): + # Framework-provided function + return True + +def save_settings(category, settings): + # Framework-provided function + pass \ No newline at end of file diff --git a/wwwroot/add_service.ui b/wwwroot/add_service.ui index fffa4f1..4a222e6 100644 --- a/wwwroot/add_service.ui +++ b/wwwroot/add_service.ui @@ -57,7 +57,7 @@ "widgettype": "Button", "options": { "icon": "fa fa-plus", - "backgroundColor": "#22C55E", + "bgcolor": "#22C55E", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", @@ -76,7 +76,7 @@ { "widgettype": "Button", "options": { - "backgroundColor": "#64748B", + "bgcolor": "#64748B", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", diff --git a/wwwroot/edit_service.ui b/wwwroot/edit_service.ui index faddc44..a9e8e90 100644 --- a/wwwroot/edit_service.ui +++ b/wwwroot/edit_service.ui @@ -59,7 +59,7 @@ "options": { "icon": "fa fa-save", "label": "Update Service", - "backgroundColor": "#3B82F6", + "bgcolor": "#3B82F6", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", @@ -78,7 +78,7 @@ "widgettype": "Button", "options": { "label": "Cancel", - "backgroundColor": "#64748B", + "bgcolor": "#64748B", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", diff --git a/wwwroot/index.ui b/wwwroot/index.ui index 2aecdae..01fb28a 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -3,7 +3,7 @@ "options": { "width": "100%", "height": "100%", - "backgroundColor": "#020617", + "bgcolor": "#020617", "color": "#F8FAFC" }, "subwidgets": [ @@ -12,7 +12,7 @@ "options": { "width": "100%", "height": "60px", - "backgroundColor": "#0F172A", + "bgcolor": "#0F172A", "borderBottom": "1px solid #334155", "padding": "0 20px", "alignItems": "center" @@ -35,7 +35,7 @@ "options": { "icon": "fa fa-plus", "label": "New Session", - "backgroundColor": "#22C55E", + "bgcolor": "#22C55E", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", @@ -96,7 +96,7 @@ "widgettype": "VBox", "id": "main-content", "options": { - "width": "calc(100% - 250px)", + "css": "filler", "height": "100%", "padding": "20px" }, @@ -133,7 +133,7 @@ "options": { "width": "33%", "height": "120px", - "backgroundColor": "#1E293B", + "bgcolor": "#1E293B", "borderRadius": "8px", "padding": "20px", "border": "1px solid #334155" @@ -164,7 +164,7 @@ "options": { "width": "33%", "height": "120px", - "backgroundColor": "#1E293B", + "bgcolor": "#1E293B", "borderRadius": "8px", "padding": "20px", "border": "1px solid #334155" @@ -195,7 +195,7 @@ "options": { "width": "33%", "height": "120px", - "backgroundColor": "#1E293B", + "bgcolor": "#1E293B", "borderRadius": "8px", "padding": "20px", "border": "1px solid #334155" diff --git a/wwwroot/new_session.ui b/wwwroot/new_session.ui index fb5e3a1..fa5da09 100644 --- a/wwwroot/new_session.ui +++ b/wwwroot/new_session.ui @@ -12,39 +12,102 @@ "text": "Create New Session", "fontSize": "24px", "fontWeight": "bold", - "marginBottom": "20px", - "color": "#F8FAFC" + "color": "#F8FAFC", + "marginBottom": "20px" } }, { "widgettype": "Form", "id": "new-session-form", "options": { - "fields": [ - { - "name": "service_id", - "label": "Service", - "uitype": "code", - "required": true, - "data_url": "/hermes-web-cli/hermes_services/list/" - }, - { - "name": "initial_message", - "label": "Initial Message", - "uitype": "textarea", - "required": true, - "placeholder": "Enter your initial message to start the conversation..." - } - ], - "submit_url": "/hermes-web-cli/sessions/", - "method": "POST" + "width": "100%", + "maxWidth": "600px" }, - "binds": [ + "subwidgets": [ { - "wid": "self", - "event": "submited", - "actiontype": "script", - "script": "const data = event.params; if (data && data.session_id) { bricks.app.load_widget('{{entire_url(\"session_detail.ui\")}}?session_id=' + data.session_id, 'app.main-content', 'replace'); }" + "widgettype": "Input", + "id": "session-name", + "options": { + "label": "Session Name", + "placeholder": "Enter session name...", + "width": "100%", + "marginBottom": "16px" + } + }, + { + "widgettype": "Select", + "id": "model-select", + "options": { + "label": "AI Model", + "placeholder": "Select model...", + "width": "100%", + "marginBottom": "16px", + "items": [] + } + }, + { + "widgettype": "Textarea", + "id": "initial-prompt", + "options": { + "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", + "target": "app.create_session", + "mode": "call" + } + ] + }, + { + "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" + } + ] + } + ] } ] } diff --git a/wwwroot/services.ui b/wwwroot/services.ui index 469ea1f..81e73a3 100644 --- a/wwwroot/services.ui +++ b/wwwroot/services.ui @@ -9,115 +9,201 @@ { "widgettype": "Text", "options": { - "text": "Hermes Services", + "text": "Connected Services", "fontSize": "24px", "fontWeight": "bold", - "marginBottom": "20px", - "color": "#F8FAFC" + "color": "#F8FAFC", + "marginBottom": "20px" } }, { - "widgettype": "Button", + "widgettype": "HBox", "options": { - "icon": "fa fa-plus", - "backgroundColor": "#22C55E", - "color": "#FFFFFF", - "border": "none", - "borderRadius": "6px", - "padding": "10px 20px", + "width": "100%", "marginBottom": "20px", - "label": "Add New Service" + "alignItems": "center" }, - "binds": [ + "subwidgets": [ { - "wid": "self", - "event": "click", - "actiontype": "urlwidget", - "target": "app.main-content", + "widgettype": "Input", + "id": "service-search", "options": { - "url": "{{entire_url('add_service.ui')}}" + "placeholder": "Search services...", + "width": "300px", + "icon": "fa fa-search" }, - "mode": "replace" + "binds": [ + { + "wid": "self", + "event": "input", + "actiontype": "script", + "target": "app.filter_services", + "mode": "call" + } + ] + }, + { + "widgettype": "Filler" + }, + { + "widgettype": "Button", + "options": { + "icon": "fa fa-plus", + "label": "Add Service", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "8px 16px" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.add_service", + "mode": "call" + } + ] } ] }, { - "widgettype": "DataViewer", + "widgettype": "List", + "id": "services-list", "options": { - "data_url": "/hermes-web-cli/hermes_services/", - "page_rows": 10, - "row_options": { - "fields": [ - { - "name": "id", - "label": "Service ID", - "uitype": "str" - }, - { - "name": "name", - "label": "Name", - "uitype": "str" - }, - { - "name": "service_url", - "label": "URL", - "uitype": "str" - }, - { - "name": "description", - "label": "Description", - "uitype": "str" - }, - { - "name": "status", - "label": "Status", - "uitype": "str" - }, - { - "name": "created_at", - "label": "Created", - "uitype": "date" - } - ] - }, - "toolbar": { - "tools": [ - { - "name": "test_connection", - "text": "Test Connection", - "icon": "fa fa-plug" - }, - { - "name": "edit_service", - "text": "Edit", - "icon": "fa fa-edit" - }, - { - "name": "delete_service", - "text": "Delete", - "icon": "fa fa-trash" - } - ] - } + "width": "100%", + "height": "calc(100% - 100px)", + "itemHeight": "100px", + "items": [] }, - "binds": [ + "subwidgets": [ { - "wid": "self", - "event": "test_connection", - "actiontype": "script", - "script": "const selectedRow = event.params; if (selectedRow) { fetch(`/hermes-web-cli/services/test?id=${selectedRow.id}`).then(response => response.json()).then(data => { alert(`Connection test: ${data.status_message}`); }); }" - }, - { - "wid": "self", - "event": "edit_service", - "actiontype": "script", - "script": "const selectedRow = event.params; if (selectedRow) { const url = `{{entire_url('edit_service.ui')}}?service_id=${selectedRow.id}`; bricks.app.load_widget(url, 'app.main-content', 'replace'); }" - }, - { - "wid": "self", - "event": "delete_service", - "actiontype": "script", - "script": "const selectedRow = event.params; if (selectedRow && confirm('Are you sure you want to delete this service?')) { fetch(`/hermes-web-cli/hermes_services/?id=${selectedRow.id}`, { method: 'DELETE' }).then(() => { this.refresh(); }); }" + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "padding": "16px", + "border": "1px solid #334155", + "borderRadius": "8px", + "bgcolor": "#1E293B" + }, + "subwidgets": [ + { + "widgettype": "HBox", + "options": { + "width": "100%", + "alignItems": "center", + "marginBottom": "8px" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "text": "{{item.name}}", + "fontSize": "18px", + "fontWeight": "600", + "color": "#F8FAFC" + } + }, + { + "widgettype": "Filler" + }, + { + "widgettype": "Badge", + "options": { + "text": "{{item.status}}", + "bgcolor": "{{item.status == 'Connected' ? '#22C55E' : '#EF4444'}}", + "color": "#FFFFFF", + "borderRadius": "12px", + "padding": "4px 12px", + "fontSize": "12px" + } + } + ] + }, + { + "widgettype": "Text", + "options": { + "text": "{{item.endpoint}}", + "fontSize": "14px", + "color": "#CBD5E1", + "marginBottom": "8px" + } + }, + { + "widgettype": "HBox", + "options": { + "width": "100%", + "gap": "12px" + }, + "subwidgets": [ + { + "widgettype": "Button", + "options": { + "label": "Edit", + "bgcolor": "#3B82F6", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "4px", + "padding": "6px 12px", + "fontSize": "12px" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.edit_service", + "mode": "call" + } + ] + }, + { + "widgettype": "Button", + "options": { + "label": "Remove", + "bgcolor": "#EF4444", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "4px", + "padding": "6px 12px", + "fontSize": "12px" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.remove_service", + "mode": "call" + } + ] + }, + { + "widgettype": "Button", + "options": { + "label": "Test Connection", + "bgcolor": "#8B5CF6", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "4px", + "padding": "6px 12px", + "fontSize": "12px" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.test_service_connection", + "mode": "call" + } + ] + } + ] + } + ] } ] } diff --git a/wwwroot/session_chat.ui b/wwwroot/session_chat.ui index 14a5fde..5e14156 100644 --- a/wwwroot/session_chat.ui +++ b/wwwroot/session_chat.ui @@ -31,7 +31,7 @@ "options": { "icon": "fa fa-arrow-left", "label": "Back to Sessions", - "backgroundColor": "#1E293B", + "bgcolor": "#1E293B", "color": "#F8FAFC", "border": "1px solid #334155", "borderRadius": "6px", @@ -57,7 +57,7 @@ "options": { "width": "100%", "height": "calc(100% - 100px)", - "backgroundColor": "#1E293B", + "bgcolor": "#1E293B", "borderRadius": "8px", "padding": "20px", "border": "1px solid #334155", diff --git a/wwwroot/session_detail.ui b/wwwroot/session_detail.ui index 7329207..a679bb7 100644 --- a/wwwroot/session_detail.ui +++ b/wwwroot/session_detail.ui @@ -71,7 +71,7 @@ "widgettype": "Button", "options": { "icon": "fa fa-paper-plane", - "backgroundColor": "#22C55E", + "bgcolor": "#22C55E", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", @@ -90,7 +90,7 @@ { "widgettype": "Button", "options": { - "backgroundColor": "#64748B", + "bgcolor": "#64748B", "color": "#FFFFFF", "border": "none", "borderRadius": "6px", diff --git a/wwwroot/sessions.ui b/wwwroot/sessions.ui index e6595ef..f8e6208 100644 --- a/wwwroot/sessions.ui +++ b/wwwroot/sessions.ui @@ -12,76 +12,135 @@ "text": "Active Sessions", "fontSize": "24px", "fontWeight": "bold", - "marginBottom": "20px", - "color": "#F8FAFC" + "color": "#F8FAFC", + "marginBottom": "20px" } }, { - "widgettype": "DataViewer", + "widgettype": "HBox", "options": { - "data_url": "/hermes-web-cli/active_sessions/", - "page_rows": 10, - "row_options": { - "fields": [ + "width": "100%", + "marginBottom": "20px", + "alignItems": "center" + }, + "subwidgets": [ + { + "widgettype": "Input", + "id": "session-search", + "options": { + "placeholder": "Search sessions...", + "width": "300px", + "icon": "fa fa-search" + }, + "binds": [ { - "name": "session_id", - "label": "Session ID", - "uitype": "str" - }, - { - "name": "session_name", - "label": "Session Name", - "uitype": "str" - }, - { - "name": "service_name", - "label": "Service", - "uitype": "str" - }, - { - "name": "message_count", - "label": "Messages", - "uitype": "int" - }, - { - "name": "created_at", - "label": "Created", - "uitype": "date" - }, - { - "name": "status", - "label": "Status", - "uitype": "str" + "wid": "self", + "event": "input", + "actiontype": "script", + "target": "app.filter_sessions", + "mode": "call" } ] }, - "toolbar": { - "tools": [ + { + "widgettype": "Filler" + }, + { + "widgettype": "Button", + "options": { + "icon": "fa fa-plus", + "label": "New Session", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "8px 16px" + }, + "binds": [ { - "name": "open_session", - "text": "Open", - "icon": "fa fa-folder-open" - }, - { - "name": "delete_session", - "text": "Delete", - "icon": "fa fa-trash" + "wid": "self", + "event": "click", + "actiontype": "urlwidget", + "target": "app.main-content", + "options": { + "url": "{{entire_url('new_session.ui')}}" + }, + "mode": "replace" } ] } + ] + }, + { + "widgettype": "List", + "id": "sessions-list", + "options": { + "width": "100%", + "height": "calc(100% - 100px)", + "itemHeight": "80px", + "items": [] }, - "binds": [ + "subwidgets": [ { - "wid": "self", - "event": "open_session", - "actiontype": "script", - "script": "const selectedRow = event.params; if (selectedRow) { const url = `{{entire_url('session_detail.ui')}}?session_id=${selectedRow.session_id}`; bricks.app.load_widget(url, 'app.main-content', 'replace'); }" - }, - { - "wid": "self", - "event": "delete_session", - "actiontype": "script", - "script": "const selectedRow = event.params; if (selectedRow) { fetch(`/hermes-web-cli/active_sessions/?session_id=${selectedRow.session_id}`, { method: 'DELETE' }).then(() => { this.refresh(); }); }" + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "padding": "12px", + "border": "1px solid #334155", + "borderRadius": "8px", + "bgcolor": "#1E293B", + "cursor": "pointer" + }, + "subwidgets": [ + { + "widgettype": "HBox", + "options": { + "width": "100%", + "alignItems": "center" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "text": "{{item.name}}", + "fontSize": "16px", + "fontWeight": "600", + "color": "#F8FAFC" + } + }, + { + "widgettype": "Filler" + }, + { + "widgettype": "Text", + "options": { + "text": "{{item.last_active}}", + "fontSize": "12px", + "color": "#94A3B8" + } + } + ] + }, + { + "widgettype": "Text", + "options": { + "text": "{{item.model}}", + "fontSize": "14px", + "color": "#CBD5E1", + "marginTop": "4px" + } + } + ], + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.open_session", + "mode": "call" + } + ] } ] } diff --git a/wwwroot/settings.ui b/wwwroot/settings.ui index 6d4bf8f..f6e66d8 100644 --- a/wwwroot/settings.ui +++ b/wwwroot/settings.ui @@ -12,87 +12,340 @@ "text": "Settings", "fontSize": "24px", "fontWeight": "bold", - "marginBottom": "20px", - "color": "#F8FAFC" + "color": "#F8FAFC", + "marginBottom": "20px" } }, { - "widgettype": "Form", - "id": "settings-form", - "options": { - "fields": [ - { - "name": "default_service", - "label": "Default Service", - "uitype": "select", - "data_url": "/hermes-web-cli/hermes_services/" - }, - { - "name": "auto_save_sessions", - "label": "Auto-save Sessions", - "uitype": "bool", - "default": true - }, - { - "name": "session_timeout_minutes", - "label": "Session Timeout (minutes)", - "uitype": "int", - "default": 60 - }, - { - "name": "max_concurrent_sessions", - "label": "Max Concurrent Sessions", - "uitype": "int", - "default": 10 - } - ] - } - }, - { - "widgettype": "HBox", + "widgettype": "Tabs", + "id": "settings-tabs", "options": { "width": "100%", - "height": "auto", - "marginTop": "20px", - "gap": "10px" + "height": "calc(100% - 60px)", + "tabs": [ + { + "label": "General", + "id": "general-tab" + }, + { + "label": "AI Models", + "id": "models-tab" + }, + { + "label": "Security", + "id": "security-tab" + }, + { + "label": "Appearance", + "id": "appearance-tab" + } + ] }, "subwidgets": [ { - "widgettype": "Button", + "widgettype": "VBox", + "id": "general-tab", "options": { - "icon": "fa fa-save", - "backgroundColor": "#3B82F6", - "color": "#FFFFFF", - "border": "none", - "borderRadius": "6px", - "padding": "10px 20px", - "label": "Save Settings" + "width": "100%", + "height": "100%", + "padding": "20px" }, - "binds": [ + "subwidgets": [ { - "wid": "self", - "event": "click", - "actiontype": "script", - "script": "const formData = bricks.app.get_widget('settings-form').get_data(); fetch('/hermes-web-cli/settings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(formData) }).then(() => { alert('Settings saved successfully!'); });" + "widgettype": "Form", + "options": { + "width": "100%", + "maxWidth": "600px" + }, + "subwidgets": [ + { + "widgettype": "Input", + "id": "default-model", + "options": { + "label": "Default AI Model", + "placeholder": "Select default model...", + "width": "100%", + "marginBottom": "16px" + } + }, + { + "widgettype": "Input", + "id": "session-timeout", + "options": { + "label": "Session Timeout (minutes)", + "type": "number", + "placeholder": "Enter timeout in minutes...", + "width": "100%", + "marginBottom": "16px" + } + }, + { + "widgettype": "Checkbox", + "id": "auto-save", + "options": { + "label": "Auto-save sessions", + "checked": true, + "marginBottom": "24px" + } + }, + { + "widgettype": "Button", + "options": { + "label": "Save General Settings", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "10px 20px", + "fontWeight": "600" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.save_general_settings", + "mode": "call" + } + ] + } + ] } ] }, { - "widgettype": "Button", + "widgettype": "VBox", + "id": "models-tab", "options": { - "backgroundColor": "#EF4444", - "color": "#FFFFFF", - "border": "none", - "borderRadius": "6px", - "padding": "10px 20px", - "label": "Reset to Defaults" + "width": "100%", + "height": "100%", + "padding": "20px" }, - "binds": [ + "subwidgets": [ { - "wid": "self", - "event": "click", - "actiontype": "script", - "script": "if (confirm('Are you sure you want to reset all settings to defaults?')) { fetch('/hermes-web-cli/settings/reset', { method: 'POST' }).then(() => { bricks.app.get_widget('settings-form').load_data(); alert('Settings reset to defaults!'); }); }" + "widgettype": "Text", + "options": { + "text": "Configure AI Models", + "fontSize": "18px", + "fontWeight": "600", + "color": "#F8FAFC", + "marginBottom": "16px" + } + }, + { + "widgettype": "List", + "id": "models-list", + "options": { + "width": "100%", + "height": "calc(100% - 80px)", + "itemHeight": "120px", + "items": [] + }, + "subwidgets": [ + { + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "padding": "16px", + "border": "1px solid #334155", + "borderRadius": "8px", + "bgcolor": "#1E293B", + "marginBottom": "12px" + }, + "subwidgets": [ + { + "widgettype": "Input", + "options": { + "label": "Model Name", + "value": "{{item.name}}", + "width": "100%", + "marginBottom": "8px" + } + }, + { + "widgettype": "Input", + "options": { + "label": "Provider", + "value": "{{item.provider}}", + "width": "100%", + "marginBottom": "8px" + } + }, + { + "widgettype": "HBox", + "options": { + "width": "100%", + "gap": "12px" + }, + "subwidgets": [ + { + "widgettype": "Button", + "options": { + "label": "Update", + "bgcolor": "#3B82F6", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "4px", + "padding": "6px 12px", + "fontSize": "12px" + } + }, + { + "widgettype": "Button", + "options": { + "label": "Remove", + "bgcolor": "#EF4444", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "4px", + "padding": "6px 12px", + "fontSize": "12px" + } + } + ] + } + ] + } + ] + }, + { + "widgettype": "Button", + "options": { + "label": "Add New Model", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "8px 16px", + "marginTop": "12px" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.add_model", + "mode": "call" + } + ] + } + ] + }, + { + "widgettype": "VBox", + "id": "security-tab", + "options": { + "width": "100%", + "height": "100%", + "padding": "20px" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "text": "Security Settings", + "fontSize": "18px", + "fontWeight": "600", + "color": "#F8FAFC", + "marginBottom": "16px" + } + }, + { + "widgettype": "Checkbox", + "id": "require-auth", + "options": { + "label": "Require authentication for web access", + "checked": false, + "marginBottom": "12px" + } + }, + { + "widgettype": "Checkbox", + "id": "encrypt-storage", + "options": { + "label": "Encrypt local storage", + "checked": false, + "marginBottom": "24px" + } + }, + { + "widgettype": "Button", + "options": { + "label": "Save Security Settings", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "10px 20px", + "fontWeight": "600" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.save_security_settings", + "mode": "call" + } + ] + } + ] + }, + { + "widgettype": "VBox", + "id": "appearance-tab", + "options": { + "width": "100%", + "height": "100%", + "padding": "20px" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "text": "Appearance Settings", + "fontSize": "18px", + "fontWeight": "600", + "color": "#F8FAFC", + "marginBottom": "16px" + } + }, + { + "widgettype": "Select", + "id": "theme-select", + "options": { + "label": "Theme", + "items": [ + {"label": "Dark", "value": "dark"}, + {"label": "Light", "value": "light"}, + {"label": "System", "value": "system"} + ], + "value": "dark", + "width": "200px", + "marginBottom": "24px" + } + }, + { + "widgettype": "Button", + "options": { + "label": "Save Appearance Settings", + "bgcolor": "#22C55E", + "color": "#FFFFFF", + "border": "none", + "borderRadius": "6px", + "padding": "10px 20px", + "fontWeight": "600" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "app.save_appearance_settings", + "mode": "call" + } + ] } ] }