Skip to content

Commit 5f372d0

Browse files
authored
Merge pull request #181 from open-webui/main
fix: store HF models directly under models/ for llama-server discovery
2 parents 5ff536e + 64c3997 commit 5f372d0

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.18] - 2026-05-05
9+
10+
### Fixed
11+
12+
- **Downloaded Models Not Recognized by llama.cpp.** Models downloaded from Hugging Face are now stored directly under the `models/` directory instead of a nested `models/huggingface/` subdirectory, so llama-server's model scanner discovers them without manual symlinks. Existing models in the old location are automatically migrated on startup (#177).
13+
814
## [0.0.17] - 2026-05-03
915

1016
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "open-webui",
3-
"version": "0.0.17",
3+
"version": "0.0.18",
44
"license": "AGPL-3.0",
55
"description": "Open WebUI Desktop",
66
"main": "./out/main/index.js",

src/main/utils/huggingface.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Downloads files from HF repos, manages a local model cache,
66
* and provides listing/deletion of cached models.
77
*
8-
* Cache dir: <userData>/models/huggingface/<repo-slug>/<filename>
8+
* Cache dir: <userData>/models/<repo-slug>/<filename>
99
*/
1010

1111
import * as fs from 'fs'
@@ -33,10 +33,37 @@ export interface HfDownloadProgress {
3333
// ─── Paths ──────────────────────────────────────────────
3434

3535
const getHfCacheDir = (): string => {
36-
const dir = path.join(getInstallDir(), 'models', 'huggingface')
36+
const dir = path.join(getInstallDir(), 'models')
3737
if (!fs.existsSync(dir)) {
3838
fs.mkdirSync(dir, { recursive: true })
3939
}
40+
41+
// Migrate models from legacy models/huggingface/<slug>/ to models/<slug>/
42+
const legacyDir = path.join(dir, 'huggingface')
43+
if (fs.existsSync(legacyDir)) {
44+
try {
45+
const entries = fs.readdirSync(legacyDir, { withFileTypes: true })
46+
for (const entry of entries) {
47+
if (entry.isDirectory()) {
48+
const src = path.join(legacyDir, entry.name)
49+
const dest = path.join(dir, entry.name)
50+
if (!fs.existsSync(dest)) {
51+
fs.renameSync(src, dest)
52+
log.info(`[huggingface] Migrated ${entry.name} from legacy cache`)
53+
}
54+
}
55+
}
56+
// Remove legacy dir if empty (manifest.json may remain)
57+
const remaining = fs.readdirSync(legacyDir)
58+
if (remaining.length === 0) {
59+
fs.rmdirSync(legacyDir)
60+
log.info('[huggingface] Removed empty legacy huggingface/ directory')
61+
}
62+
} catch (e) {
63+
log.warn('[huggingface] Failed to migrate legacy cache:', e)
64+
}
65+
}
66+
4067
return dir
4168
}
4269

0 commit comments

Comments
 (0)