Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
vite-plugin-splash-screen.ts126 linesDownload Raw Back to scripts
1import { NEWLINE, TAB } from '../src/lib/constants/code';2import { APPLE_DEVICES, BUILD_CONFIG, REGEX_PATTERNS, SPLASH_LINK } from '../src/lib/constants/pwa';3import { SplashOrientation } from '../src/lib/enums/splash.enums';4import type { SplashDimensions } from '../src/lib/types';5import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';6import { resolve } from 'path';7import type { Plugin } from 'vite';8 9let processed = false;10 11const OUTPUT_DIR = process.env.LLAMA_UI_OUT_DIR ?? BUILD_CONFIG.OUTPUT_DIR;12 13/**14 * Generate iOS splash screen <link> tags from generated apple-splash-*.png files.15 * Returns an array of HTML link strings to be injected into the page head.16 */17export function generateSplashScreenLinks(outDir: string): string[] {18	const files = readdirSync(outDir).filter((f) => f.match(REGEX_PATTERNS.SPLASH_FILE));19 20	if (files.length === 0) return [];21 22	const dimMap = new Map<string, SplashDimensions>();23 24	for (const [dims, spec] of Object.entries(APPLE_DEVICES)) {25		const [w, h] = dims.split('x').map(Number);26 27		// logical-point dimensions28		dimMap.set(`${w}x${h}`, { deviceH: spec.height, deviceW: spec.width, dpr: spec.dpr });29		dimMap.set(`${h}x${w}`, { deviceH: spec.height, deviceW: spec.width, dpr: spec.dpr });30		// pixel dimensions (used by actual generated splash files)31		dimMap.set(`${w * spec.dpr}x${h * spec.dpr}`, {32			deviceH: spec.height,33			deviceW: spec.width,34			dpr: spec.dpr35		});36		dimMap.set(`${h * spec.dpr}x${w * spec.dpr}`, {37			deviceH: spec.height,38			deviceW: spec.width,39			dpr: spec.dpr40		});41	}42 43	const lightLinks: string[] = [];44	const darkLinks: string[] = [];45 46	for (const file of files) {47		const match = file.match(REGEX_PATTERNS.SPLASH_FILE);48 49		if (!match) continue;50 51		const orientation = match[1] as SplashOrientation;52		const isDark = !!match[2];53		const pixelW = parseInt(match[3]);54		const pixelH = parseInt(match[4]);55		const key = `${pixelW}x${pixelH}`;56		const spec = dimMap.get(key);57 58		if (!spec) {59			console.warn(`Unknown splash screen dimensions: ${key} (${file})`);60 61			continue;62		}63 64		const { deviceH, deviceW, dpr } = spec;65		const media = `screen and (device-width: ${deviceW}px) and (device-height: ${deviceH}px) and (-webkit-device-pixel-ratio: ${dpr}) and (orientation: ${orientation})`;66		const href = `./${file}`;67 68		if (isDark) {69			darkLinks.push(70				`${SPLASH_LINK.HTML} media="${media}${SPLASH_LINK.DARK_MEDIA_SUFFIX}" href="${href}">`71			);72		} else {73			lightLinks.push(`${SPLASH_LINK.HTML} media="${media}" href="${href}">`);74		}75	}76 77	return [...lightLinks, ...darkLinks];78}79 80export function splashScreenPlugin(): Plugin {81	return {82		apply: 'build',83		closeBundle() {84			setTimeout(() => {85				try {86					if (processed) return;87 88					processed = true;89 90					const outDir = resolve(OUTPUT_DIR);91					const indexPath = resolve(outDir, 'index.html');92 93					if (!existsSync(indexPath)) return;94 95					let content = readFileSync(indexPath, 'utf-8');96 97					// Inject iOS splash screen <link> tags into <head>.98					// The @vite-pwa/assets-generator generates apple-splash-*.png files;99					// this scans them and creates the <link> tags SvelteKit needs.100					const splashLinks = generateSplashScreenLinks(outDir);101 102					if (splashLinks.length > 0) {103						console.log(`Generated ${splashLinks.length} apple-splash link tags`);104						const splashHtml = splashLinks.map((l) => TAB + TAB + l).join(NEWLINE);105 106						content = content.replace(107							REGEX_PATTERNS.HEAD_CLOSE,108							splashHtml + NEWLINE + TAB + TAB + '</head>'109						);110					}111 112					// Remove trailing \r from Windows line endings113					content = content.replace(/\r/g, '');114					content = BUILD_CONFIG.GUIDE_COMMENT + NEWLINE + content;115 116					writeFileSync(indexPath, content, 'utf-8');117					console.log('Updated index.html');118				} catch (error) {119					console.error('Failed to process build output:', error);120				}121			}, 100);122		},123		name: 'llamacpp:splash-screen'124	};125}126 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai