* ui : add the drawer, sheet and grouped list primitives Add the drawer and sheet overlay components, the toggle and toggle group, the shared searchable input, the collapsible sections and the grouped list, and the near viewport helper they position with. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : add the shared model components and data layer Add the model row pieces shared by the selector and the manager, the models store with its download status feed, the huggingface and migration services, and the model utils, enums and constants they read through. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : rework the models selector around its providers Group the selector components under their own folder, rework the list around the provider grouping, add the mobile trigger and the download item, and derive the selection state in one hook. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : add the models manager Add the manager table with its repo, quant and status rows, the filters and the toolbar, the row actions in a drawer, the downloads section, the manage models dialog and the stories and tests. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : rework the chat form actions and the mobile experience Move the add actions into a drawer and a sheet, float the model actions in a bar on a phone, open the context panel in a drawer, and derive the attachment, reasoning and tools menus in hooks. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : move the mcp servers to the sidebar rail and tidy the dialogs Move the mcp servers dialog to the sidebar rail with its menu entries, even out the dialogs on a phone, and group the mcp and settings stores behind their own modules. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : polish the shell The secondary button gets its own look back and the chat add button its own light surface. Pressable elements get a pointer cursor again, the font rendering smooths on the app shell, and the agent skills stay out of prettier's way. The root layout props probe rework that came with this polish reads the providers api url and stays with the providers change instead. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : wrap the model id classes Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : load the model the new chat CTA picks Start a new chat selected the model but left it unloaded, so the chat opened against a server with nothing in memory. Both CTAs share a load helper now. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * refactor: Post-review fixes
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
// Guards the hidden-model rule of the selector: a hidden model leaves every
|
|
// section, while the model a conversation already uses still resolves, since it
|
|
// can be hidden and selected at the same time.
|
|
|
|
import ModelsSelectorHookHarness from './components/ModelsSelectorHookHarness.svelte';
|
|
import { ServerModelStatus, ServerRole } from '$lib/enums';
|
|
import { modelsStore } from '$lib/stores/models/index.svelte';
|
|
import { serverStore } from '$lib/stores/server.svelte';
|
|
import type { ApiModelDataEntry, ModelOption } from '$lib/types';
|
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
import { render } from 'vitest-browser-svelte';
|
|
|
|
function option(model: string): ModelOption {
|
|
return { capabilities: [], id: model, model, name: model };
|
|
}
|
|
|
|
function routerEntry(id: string, status: ServerModelStatus): ApiModelDataEntry {
|
|
return {
|
|
created: 0,
|
|
id,
|
|
in_cache: true,
|
|
object: 'model',
|
|
owned_by: 'llamacpp',
|
|
path: `/models/${id}`,
|
|
status: { value: status }
|
|
};
|
|
}
|
|
|
|
const VISIBLE = option('org/visible:Q4_K_M');
|
|
const HIDDEN = option('org/hidden:Q4_K_M');
|
|
const HIDDEN_LOADED = option('org/hidden-loaded:Q4_K_M');
|
|
const HIDDEN_FAVORITE = option('org/hidden-favorite:Q4_K_M');
|
|
|
|
beforeEach(() => {
|
|
modelsStore.models = [VISIBLE, HIDDEN, HIDDEN_LOADED, HIDDEN_FAVORITE];
|
|
modelsStore.favoriteModelIds = new Set([HIDDEN_FAVORITE.model]);
|
|
modelsStore.hiddenModelIds = new Set([HIDDEN.id, HIDDEN_LOADED.id, HIDDEN_FAVORITE.id]);
|
|
modelsStore.routerModels = [routerEntry(HIDDEN_LOADED.model, ServerModelStatus.LOADED)];
|
|
serverStore.role = ServerRole.ROUTER;
|
|
});
|
|
|
|
describe('hidden models in the selector', () => {
|
|
it('lists what is not hidden', () => {
|
|
const screen = render(ModelsSelectorHookHarness);
|
|
|
|
expect(screen.component.listedIds()).toEqual([VISIBLE.id]);
|
|
});
|
|
|
|
it('keeps a hidden favorite and a hidden loaded model out of the sections', () => {
|
|
const screen = render(ModelsSelectorHookHarness);
|
|
const listed = screen.component.listedIds();
|
|
|
|
expect(listed).not.toContain(HIDDEN_FAVORITE.id);
|
|
expect(listed).not.toContain(HIDDEN_LOADED.id);
|
|
});
|
|
|
|
it('reports an empty list when everything is hidden', () => {
|
|
modelsStore.hiddenModelIds = new Set([
|
|
VISIBLE.id,
|
|
HIDDEN.id,
|
|
HIDDEN_LOADED.id,
|
|
HIDDEN_FAVORITE.id
|
|
]);
|
|
|
|
const screen = render(ModelsSelectorHookHarness);
|
|
|
|
expect(screen.component.isEmpty()).toBe(true);
|
|
});
|
|
|
|
it('still resolves the model the conversation uses when it is hidden', () => {
|
|
const screen = render(ModelsSelectorHookHarness, {
|
|
currentModel: () => HIDDEN.model
|
|
});
|
|
|
|
expect(screen.component.shownModelId()).toBe(HIDDEN.id);
|
|
});
|
|
});
|