fix: make Laya status consistent between Settings and ChannelList (#12)
The model was reported as ready while the AI runtime was actually unreachable, and the Download action stayed visible afterwards. Distinguish model-downloaded from runtime-available in layaStatusPresentation, derive the Download action from the real combined state, and align Settings and ChannelList rendering on that single source of truth. Cover the combined status cases with tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -41,3 +41,28 @@ test('ready models expose removal without download actions', () => {
|
||||
assert.equal(view.showRemove, true);
|
||||
assert.equal(view.showDownload, false);
|
||||
});
|
||||
|
||||
test('installed model with unavailable service is not reported ready', () => {
|
||||
const view = presentLayaStatus({
|
||||
phase: 'idle',
|
||||
modelPresent: true,
|
||||
runtimeAvailable: false,
|
||||
sizeBytes: 10
|
||||
}, 'hybrid');
|
||||
assert.equal(view.ready, false);
|
||||
assert.equal(view.statusLabel, 'Local AI service unavailable');
|
||||
assert.equal(view.modelLabel, 'Model: Downloaded');
|
||||
assert.equal(view.serviceLabel, 'Local AI service: Unavailable');
|
||||
assert.equal(view.showDownload, false);
|
||||
assert.equal(view.showRemove, true);
|
||||
assert.equal(view.showCheckAgain, true);
|
||||
assert.equal(view.showStartCommand, true);
|
||||
assert.equal(view.availabilityMessage, 'The model is installed, but the Local AI service is not running. Standard channel matching is being used.');
|
||||
});
|
||||
|
||||
test('missing model keeps download available', () => {
|
||||
const view = presentLayaStatus({ phase: 'idle', modelPresent: false, runtimeAvailable: false });
|
||||
assert.equal(view.showDownload, true);
|
||||
assert.equal(view.showRemove, false);
|
||||
assert.equal(view.showCheckAgain, false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user