fix learning hub model selector
This commit is contained in:
parent
9167532a14
commit
27c3e07d98
2 changed files with 11 additions and 6 deletions
|
|
@ -695,11 +695,9 @@
|
||||||
function populateAiModelSelect() {
|
function populateAiModelSelect() {
|
||||||
var sel = document.getElementById('lh-ai-model');
|
var sel = document.getElementById('lh-ai-model');
|
||||||
if (!sel || sel.options.length > 1) return;
|
if (!sel || sel.options.length > 1) return;
|
||||||
// Copy options from global model select
|
if (typeof window._buildModelOptions === 'function') {
|
||||||
var globalSel = document.getElementById('global-model-select');
|
window._buildModelOptions(sel);
|
||||||
if (!globalSel) return;
|
}
|
||||||
sel.innerHTML = globalSel.innerHTML;
|
|
||||||
sel.value = globalSel.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchAiTab(tabName) {
|
function switchAiTab(tabName) {
|
||||||
|
|
@ -810,7 +808,7 @@
|
||||||
var slideCount = document.getElementById('lh-ai-slide-count') ? document.getElementById('lh-ai-slide-count').value : '';
|
var slideCount = document.getElementById('lh-ai-slide-count') ? document.getElementById('lh-ai-slide-count').value : '';
|
||||||
|
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('model', model);
|
if (model) formData.append('model', model);
|
||||||
formData.append('questionCount', questionCount);
|
formData.append('questionCount', questionCount);
|
||||||
formData.append('contentType', contentType);
|
formData.append('contentType', contentType);
|
||||||
if (refinement) formData.append('refinement', refinement);
|
if (refinement) formData.append('refinement', refinement);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,13 @@ test('top bar model selector is removed and omitted selections use backend defau
|
||||||
assert.match(selector, /return undefined/);
|
assert.match(selector, /return undefined/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('learning hub model selector uses shared tab model options', () => {
|
||||||
|
const learningHub = read('public/js/learningHub.js');
|
||||||
|
assert.match(learningHub, /window\._buildModelOptions\(sel\)/);
|
||||||
|
assert.doesNotMatch(learningHub, /global-model-select|globalSel\.innerHTML/);
|
||||||
|
assert.match(learningHub, /if \(model\) formData\.append\('model', model\)/);
|
||||||
|
});
|
||||||
|
|
||||||
test('backend AI calls use admin default when request omits model', () => {
|
test('backend AI calls use admin default when request omits model', () => {
|
||||||
const ai = read('src/utils/ai.js');
|
const ai = read('src/utils/ai.js');
|
||||||
assert.match(ai, /async function resolveModel\(requestedModel\)/);
|
assert.match(ai, /async function resolveModel\(requestedModel\)/);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue