* 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
92 lines
2.6 KiB
TypeScript
92 lines
2.6 KiB
TypeScript
// Guards the row behaviour of the manager table: a row selects its model with a
|
|
// click or from the keyboard, and a repo row toggles its quants the same way.
|
|
|
|
import ModelsManagerRowWrapper from './components/ModelsManagerRowWrapper.svelte';
|
|
import ModelsManagerRepoRow from '$lib/components/app/models/ModelsManager/ModelsManagerRepoRow.svelte';
|
|
import type { ModelQuantGroup } from '$lib/components/app/models/ModelsManager/utils';
|
|
import { ModelGroupKind, ServerRole } from '$lib/enums';
|
|
import { serverStore } from '$lib/stores/server.svelte';
|
|
import type { ModelOption } from '$lib/types/models';
|
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
import { userEvent } from 'vitest/browser';
|
|
import { render } from 'vitest-browser-svelte';
|
|
|
|
const option: ModelOption = {
|
|
capabilities: [],
|
|
id: 'org/Qwen3-8B:Q4_K_M',
|
|
model: 'org/Qwen3-8B:Q4_K_M',
|
|
name: 'Qwen3-8B'
|
|
};
|
|
const entry: ModelQuantGroup = {
|
|
base: option,
|
|
key: 'org/Qwen3-8B',
|
|
kind: ModelGroupKind.QUANTS,
|
|
quants: [
|
|
option,
|
|
{ ...option, id: 'org/Qwen3-8B:Q8_0', model: 'org/Qwen3-8B:Q8_0', name: 'Qwen3-8B-Q8_0' }
|
|
]
|
|
};
|
|
/** The name the row carries once the model id is split into its badges. */
|
|
const ROW_NAME = /org\/Qwen3\s+8B/;
|
|
|
|
describe('manager model row', () => {
|
|
let selected: ModelOption[] = [];
|
|
|
|
beforeEach(() => {
|
|
selected = [];
|
|
// the row only offers a load control on a router server
|
|
serverStore.role = ServerRole.ROUTER;
|
|
});
|
|
|
|
function row() {
|
|
return render(ModelsManagerRowWrapper, {
|
|
onSelect: (picked: ModelOption) => selected.push(picked),
|
|
option,
|
|
selected: false
|
|
});
|
|
}
|
|
|
|
it('selects the model from the row', async () => {
|
|
const screen = await row();
|
|
|
|
await screen.getByRole('button', { name: ROW_NAME }).click();
|
|
|
|
expect(selected).toEqual([option]);
|
|
});
|
|
|
|
it('selects the model from the keyboard', async () => {
|
|
const screen = await row();
|
|
const target = screen.getByRole('button', { name: ROW_NAME }).element();
|
|
|
|
target.focus();
|
|
await userEvent.keyboard('{Enter}');
|
|
|
|
expect(selected).toEqual([option]);
|
|
});
|
|
|
|
it('keeps the load and actions controls of the row', async () => {
|
|
const screen = await row();
|
|
|
|
await expect
|
|
.element(screen.getByRole('button', { exact: true, name: 'Model actions' }))
|
|
.toBeVisible();
|
|
expect(screen.container.querySelector('[aria-label="Load model"]')).not.toBeNull();
|
|
});
|
|
});
|
|
|
|
describe('manager repo row', () => {
|
|
it('toggles the quants from the row', async () => {
|
|
let toggles = 0;
|
|
|
|
const screen = await render(ModelsManagerRepoRow, {
|
|
entry,
|
|
expanded: true,
|
|
onToggle: () => (toggles += 1)
|
|
});
|
|
|
|
await screen.getByRole('button', { name: /2 quants available/ }).click();
|
|
|
|
expect(toggles).toBe(1);
|
|
});
|
|
});
|