secubox-openwrt/package/secubox/luci-app-localai/htdocs/luci-static/resources/view/localai/settings.js
CyberMind-FR 6b28c4260b feat(localai): Add LocalAI LuCI app with chat, models management and portal integration
- Add secubox-app-localai package with LXC container support for LocalAI service
- Add luci-app-localai with dashboard, chat, models and settings views
- Implement RPCD backend for LocalAI API integration via /v1/models and /v1/chat/completions
- Use direct RPC declarations in LuCI views for reliable frontend communication
- Add LocalAI and Glances to secubox-portal services page
- Move Glances from services to monitoring section

Packages:
- secubox-app-localai: 0.1.0-r1
- luci-app-localai: 0.1.0-r8
- luci-app-secubox-portal: 0.6.0-r5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:54:13 +01:00

92 lines
2.7 KiB
JavaScript

'use strict';
'require view';
'require form';
'require uci';
return view.extend({
load: function() {
return uci.load('localai');
},
render: function() {
var m, s, o;
m = new form.Map('localai', _('LocalAI Configuration'),
_('Configure LocalAI service settings. Changes require a service restart.'));
// Main settings section with tabs
s = m.section(form.TypedSection, 'main', _('Service Settings'));
s.anonymous = true;
s.addremove = false;
s.tab('general', _('General'));
s.tab('paths', _('Storage'));
// General tab options
o = s.taboption('general', form.Flag, 'enabled', _('Enable Service'));
o.default = '0';
o.rmempty = false;
o = s.taboption('general', form.Value, 'api_port', _('API Port'));
o.datatype = 'port';
o.default = '8080';
o.placeholder = '8080';
o = s.taboption('general', form.Value, 'api_host', _('API Host'));
o.default = '0.0.0.0';
o.placeholder = '0.0.0.0';
o.description = _('Use 0.0.0.0 to listen on all interfaces');
o = s.taboption('general', form.Value, 'memory_limit', _('Memory Limit'));
o.default = '2G';
o.placeholder = '2G';
o.description = _('Maximum memory for the container (e.g., 2G, 4G)');
o = s.taboption('general', form.Value, 'threads', _('CPU Threads'));
o.datatype = 'uinteger';
o.default = '4';
o.placeholder = '4';
o.description = _('Number of CPU threads for inference');
o = s.taboption('general', form.Value, 'context_size', _('Context Size'));
o.datatype = 'uinteger';
o.default = '2048';
o.placeholder = '2048';
o.description = _('Maximum context window size in tokens');
o = s.taboption('general', form.Flag, 'cors', _('Enable CORS'));
o.default = '1';
o.description = _('Allow cross-origin requests to API');
o = s.taboption('general', form.Flag, 'debug', _('Debug Mode'));
o.default = '0';
o.description = _('Enable verbose logging');
// Paths tab options
o = s.taboption('paths', form.Value, 'data_path', _('Data Directory'));
o.default = '/srv/localai';
o.placeholder = '/srv/localai';
o = s.taboption('paths', form.Value, 'models_path', _('Models Directory'));
o.default = '/srv/localai/models';
o.placeholder = '/srv/localai/models';
// GPU section (experimental)
s = m.section(form.TypedSection, 'gpu', _('GPU Acceleration (Experimental)'));
s.anonymous = true;
s.addremove = false;
o = s.option(form.Flag, 'enabled', _('Enable GPU'));
o.default = '0';
o.description = _('Enable GPU acceleration (requires compatible hardware)');
o = s.option(form.ListValue, 'backend', _('GPU Backend'));
o.value('vulkan', 'Vulkan (ARM64)');
o.value('cuda', 'CUDA (Nvidia)');
o.value('rocm', 'ROCm (AMD)');
o.default = 'vulkan';
o.depends('enabled', '1');
return m.render();
}
});