Skip to content

Commit 97447fc

Browse files
committed
feat: display inference server runtime
Signed-off-by: Philippe Martin <[email protected]>
1 parent 9258c0c commit 97447fc

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**********************************************************************
2+
* Copyright (C) 2025 Red Hat, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
***********************************************************************/
18+
19+
import { test, vi, beforeEach } from 'vitest';
20+
import { render, screen } from '@testing-library/svelte';
21+
import ServiceColumnRuntime from './ServiceColumnRuntime.svelte';
22+
import { InferenceType, type InferenceServer } from '@shared/models/IInference';
23+
24+
beforeEach(() => {
25+
vi.resetAllMocks();
26+
});
27+
28+
test('should display label for type', async () => {
29+
render(ServiceColumnRuntime, {
30+
object: {
31+
type: InferenceType.LLAMA_CPP,
32+
} as InferenceServer,
33+
});
34+
35+
screen.getByText('llamacpp');
36+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script lang="ts">
2+
import { inferenceTypeLabel, type InferenceServer } from '@shared/models/IInference';
3+
import Badge from '../../Badge.svelte';
4+
5+
export let object: InferenceServer;
6+
</script>
7+
8+
<Badge content={inferenceTypeLabel(object.type)} />

packages/frontend/src/pages/InferenceServers.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import { studioClient } from '/@/utils/client';
1010
import { router } from 'tinro';
1111
import { onMount } from 'svelte';
1212
import { Button, Table, TableColumn, TableRow, NavPage, EmptyScreen } from '@podman-desktop/ui-svelte';
13+
import ServiceColumnRuntime from '/@/lib/table/service/ServiceColumnRuntime.svelte';
1314
1415
const columns: TableColumn<InferenceServer>[] = [
1516
new TableColumn<InferenceServer>('Status', { width: '70px', renderer: ServiceStatus, align: 'center' }),
1617
new TableColumn<InferenceServer>('Name', { width: '1fr', renderer: ServiceColumnName, align: 'left' }),
1718
new TableColumn<InferenceServer>('Model', { renderer: ServiceColumnModelName, align: 'left' }),
19+
new TableColumn<InferenceServer>('Runtime', { width: '90px', renderer: ServiceColumnRuntime, align: 'left' }),
1820
new TableColumn<InferenceServer>('Actions', { width: '80px', renderer: ServiceAction, align: 'right' }),
1921
];
2022
const row = new TableRow<InferenceServer>({ selectable: (_service): boolean => true });

packages/shared/src/models/IInference.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ export enum InferenceType {
2323
NONE = 'none',
2424
}
2525

26+
const InferenceTypeLabel = {
27+
'llama-cpp': 'llamacpp',
28+
'whisper-cpp': 'whispercpp',
29+
none: 'None',
30+
};
31+
32+
export function inferenceTypeLabel(type: InferenceType): string {
33+
if (type in InferenceTypeLabel) {
34+
return InferenceTypeLabel[type];
35+
}
36+
return InferenceTypeLabel['none'];
37+
}
38+
2639
export type InferenceServerStatus = 'stopped' | 'running' | 'deleting' | 'stopping' | 'error' | 'starting';
2740

2841
export interface InferenceServer {

0 commit comments

Comments
 (0)