feat: add logic_level and primary_use metadata to model groups
Schema: Added logic_level (INTEGER) and primary_use (TEXT) columns to model_groups table with auto-migration for existing databases. Seed: Three new default groups: heavy-logic (level 9) — Complex Coding, Logic, Agents standard-pro (level 5) — General Assistant, Long Docs fast-flow (level 2) — Classification, JSON, Basic Q&A Admin API: INSERT/UPDATE handlers now accept and persist the new fields. Dashboard: Table shows Level and Primary Use columns; form includes both fields with appropriate inputs and placeholders.
This commit is contained in:
@@ -30,12 +30,14 @@ class ModelGroupsPage {
|
||||
}
|
||||
|
||||
let html = '<table class="data-table"><thead><tr>';
|
||||
html += '<th>Group ID</th><th>Strategy</th><th>Targets</th><th>Actions</th>';
|
||||
html += '<th>Group ID</th><th>Level</th><th>Primary Use</th><th>Strategy</th><th>Targets</th><th>Actions</th>';
|
||||
html += '</tr></thead><tbody>';
|
||||
|
||||
groups.forEach(g => {
|
||||
html += '<tr>';
|
||||
html += '<td><code>' + this.esc(g.id) + '</code></td>';
|
||||
html += '<td>' + (g.logic_level != null ? g.logic_level : '—') + '</td>';
|
||||
html += '<td>' + this.esc(g.primary_use || '—') + '</td>';
|
||||
html += '<td><span class="badge">' + this.esc(g.strategy) + '</span></td>';
|
||||
html += '<td><code>' + this.esc(g.targets) + '</code></td>';
|
||||
html += '<td>';
|
||||
@@ -106,6 +108,18 @@ class ModelGroupsPage {
|
||||
<textarea id="mg-rules" rows="4" placeholder='[{"pattern":"step by step","target":1}]'>${group && group.heuristic_rules ? group.heuristic_rules : ''}</textarea>
|
||||
<small>Pattern to match in user messages. target = index into targets array.</small>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<label>Logic Level (1-10)</label>
|
||||
<input type="number" id="mg-level" value="${group && group.logic_level != null ? group.logic_level : ''}" min="1" max="10"
|
||||
placeholder="e.g. 8 for heavy logic, 2 for fast/basic">
|
||||
<small>Rough complexity scale. 1-3: fast/light, 4-7: standard, 8-10: heavy.</small>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<label>Primary Use</label>
|
||||
<input type="text" id="mg-primary-use" value="${this.esc(group && group.primary_use ? group.primary_use : '')}"
|
||||
placeholder="e.g. Complex Coding, Logic, Agents.">
|
||||
<small>Brief description of what this group is best used for.</small>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn" onclick="document.getElementById('model-group-form').style.display='none'">Cancel</button>
|
||||
@@ -129,12 +143,16 @@ class ModelGroupsPage {
|
||||
var selectorModel = document.getElementById('mg-selector-model').value.trim() || null;
|
||||
var thresholdVal = document.getElementById('mg-threshold').value;
|
||||
var rules = document.getElementById('mg-rules').value.trim() || null;
|
||||
var logicLevelVal = document.getElementById('mg-level').value;
|
||||
var primaryUse = document.getElementById('mg-primary-use').value.trim() || null;
|
||||
|
||||
try { JSON.parse(targets); } catch (e) { alert('Targets must be valid JSON array'); return; }
|
||||
if (rules) { try { JSON.parse(rules); } catch (e) { alert('Heuristic rules must be valid JSON'); return; } }
|
||||
|
||||
var body = { id: id, strategy: strategy, targets: targets, selector_model: selectorModel, heuristic_rules: rules };
|
||||
if (thresholdVal) body.complexity_threshold = parseInt(thresholdVal);
|
||||
if (logicLevelVal) body.logic_level = parseInt(logicLevelVal);
|
||||
if (primaryUse) body.primary_use = primaryUse;
|
||||
|
||||
try {
|
||||
if (isEdit) {
|
||||
|
||||
Reference in New Issue
Block a user