Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(hub): tighten search and resolve HuggingFace namespaces

Akarshan Biswas47ed9ac31306
diff --git a/web-app/src/routes/hub/index.tsx b/web-app/src/routes/hub/index.tsx
index df30de77b..c0ba214c2 100644
--- a/web-app/src/routes/hub/index.tsx
+++ b/web-app/src/routes/hub/index.tsx
@@ -121,8 +121,13 @@ function HubContent() {
const searchOptions = useMemo(
() => ({
includeScore: true,
- // Search in `author` and in `tags` array
- keys: ['model_name', 'quants.model_id'],
+ // Tighter than the 0.6 default so a precise query (e.g. a full HF
+ // namespace) stops surfacing loosely-related catalog models.
+ threshold: 0.3,
+ // Repo ids are long; without this Fuse penalizes matches far from the
+ // string start and misses substrings.
+ ignoreLocation: true,
+ keys: ['model_name', 'developer', 'quants.model_id'],
}),
[]
)
@@ -520,13 +525,17 @@ function HubContent() {
<div
className="cursor-pointer min-w-0 flex-1"
onClick={() => {
+ const name =
+ filteredModels[virtualItem.index].model_name
+ const isHfRepo = name.includes('/')
navigate({
to: route.hub.model,
params: {
- modelId:
- filteredModels[virtualItem.index]
- .model_name,
+ modelId: isHfRepo
+ ? name.split('/').pop()!
+ : name,
},
+ search: isHfRepo ? { repo: name } : {},
})
}}
>