Skip to content

Commit 7e80904

Browse files
author
firecoperana
committed
Add new webui from llama.cpp
1 parent 45afaf3 commit 7e80904

File tree

250 files changed

+25447
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+25447
-417
lines changed

examples/server/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ foreach(asset ${PUBLIC_ASSETS})
3333

3434
endforeach()
3535

36+
37+
# include new llamacpp webui
38+
set(ALT_PUBLIC_ASSETS
39+
index_llamacpp.html.gz
40+
)
41+
42+
foreach(asset ${ALT_PUBLIC_ASSETS})
43+
set(input "${CMAKE_CURRENT_SOURCE_DIR}/public_llamacpp/${asset}")
44+
set(output "${CMAKE_CURRENT_BINARY_DIR}/${asset}.hpp")
45+
list(APPEND TARGET_SRCS ${output})
46+
add_custom_command(
47+
DEPENDS "${input}"
48+
OUTPUT "${output}"
49+
COMMAND "${CMAKE_COMMAND}" "-DINPUT=${input}" "-DOUTPUT=${output}" -P "${PROJECT_SOURCE_DIR}/scripts/xxd.cmake"
50+
)
51+
set_source_files_properties(${output} PROPERTIES GENERATED TRUE)
52+
53+
endforeach()
54+
55+
3656
add_executable(${TARGET} ${TARGET_SRCS})
3757
install(TARGETS ${TARGET} RUNTIME)
3858
target_compile_definitions(${TARGET} PRIVATE

examples/server/public/index.html

Lines changed: 0 additions & 417 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Package Managers
2+
package-lock.json
3+
pnpm-lock.yaml
4+
yarn.lock
5+
bun.lock
6+
bun.lockb
7+
8+
# Miscellaneous
9+
/static/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"useTabs": true,
3+
"singleQuote": true,
4+
"trailingComma": "none",
5+
"printWidth": 100,
6+
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
7+
"overrides": [
8+
{
9+
"files": "*.svelte",
10+
"options": {
11+
"parser": "svelte"
12+
}
13+
}
14+
],
15+
"tailwindStylesheet": "./src/app.css"
16+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script lang="ts">
2+
import { ModeWatcher } from 'mode-watcher';
3+
import { onMount } from 'svelte';
4+
5+
interface Props {
6+
children?: any;
7+
}
8+
9+
let { children }: Props = $props();
10+
11+
onMount(() => {
12+
const root = document.documentElement;
13+
const theme = localStorage.getItem('mode-watcher-mode') || 'system';
14+
15+
if (theme === 'dark') {
16+
root.classList.add('dark');
17+
} else if (theme === 'light') {
18+
root.classList.remove('dark');
19+
} else {
20+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
21+
if (prefersDark) {
22+
root.classList.add('dark');
23+
} else {
24+
root.classList.remove('dark');
25+
}
26+
}
27+
});
28+
</script>
29+
30+
<ModeWatcher />
31+
32+
{#if children}
33+
{@const Component = children}
34+
35+
<Component />
36+
{/if}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script lang="ts">
2+
import * as Tooltip from '../src/lib/components/ui/tooltip';
3+
4+
interface Props {
5+
children: any;
6+
}
7+
8+
let { children }: Props = $props();
9+
</script>
10+
11+
<Tooltip.Provider>
12+
{@render children()}
13+
</Tooltip.Provider>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { StorybookConfig } from '@storybook/sveltekit';
2+
3+
const config: StorybookConfig = {
4+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|ts|svelte)'],
5+
addons: [
6+
'@storybook/addon-svelte-csf',
7+
'@chromatic-com/storybook',
8+
'@storybook/addon-docs',
9+
'@storybook/addon-a11y',
10+
'@storybook/addon-vitest'
11+
],
12+
framework: {
13+
name: '@storybook/sveltekit',
14+
options: {}
15+
}
16+
};
17+
export default config;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import type { Preview } from '@storybook/sveltekit';
2+
import '../src/app.css';
3+
import ModeWatcherDecorator from './ModeWatcherDecorator.svelte';
4+
import TooltipProviderDecorator from './TooltipProviderDecorator.svelte';
5+
6+
const preview: Preview = {
7+
parameters: {
8+
controls: {
9+
matchers: {
10+
color: /(background|color)$/i,
11+
date: /Date$/i
12+
}
13+
},
14+
backgrounds: {
15+
disable: true
16+
}
17+
},
18+
decorators: [
19+
(story) => ({
20+
Component: ModeWatcherDecorator,
21+
props: {
22+
children: story
23+
}
24+
}),
25+
(story) => ({
26+
Component: TooltipProviderDecorator,
27+
props: {
28+
children: story
29+
}
30+
})
31+
]
32+
};
33+
34+
export default preview;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { setProjectAnnotations } from '@storybook/sveltekit';
2+
import * as previewAnnotations from './preview';
3+
import { beforeAll } from 'vitest';
4+
5+
const project = setProjectAnnotations([previewAnnotations]);
6+
7+
beforeAll(async () => {
8+
if (project.beforeAll) {
9+
await project.beforeAll();
10+
}
11+
});

0 commit comments

Comments
 (0)