mirror of
https://github.com/open-webui/open-webui
synced 2025-04-08 14:49:46 +00:00
refac
Some checks failed
Deploy to HuggingFace Spaces / check-secret (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Has been cancelled
Python CI / Format Backend (3.11) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Deploy to HuggingFace Spaces / deploy (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
Some checks failed
Deploy to HuggingFace Spaces / check-secret (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Has been cancelled
Python CI / Format Backend (3.11) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Deploy to HuggingFace Spaces / deploy (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
This commit is contained in:
parent
c309412980
commit
d84e7d13d0
@ -66,11 +66,7 @@
|
|||||||
let selectedConnectionType = '';
|
let selectedConnectionType = '';
|
||||||
|
|
||||||
let ollamaVersion = null;
|
let ollamaVersion = null;
|
||||||
|
let selectedModelIdx = 0;
|
||||||
let selectedModelIdx = Math.max(
|
|
||||||
0,
|
|
||||||
items.findIndex((item) => item.value === value)
|
|
||||||
);
|
|
||||||
|
|
||||||
const fuse = new Fuse(
|
const fuse = new Fuse(
|
||||||
items.map((item) => {
|
items.map((item) => {
|
||||||
@ -130,6 +126,30 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$: if (selectedTag || selectedConnectionType) {
|
||||||
|
resetView();
|
||||||
|
} else {
|
||||||
|
resetView();
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetView = async () => {
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
const selectedInFiltered = filteredItems.findIndex((item) => item.value === value);
|
||||||
|
|
||||||
|
if (selectedInFiltered >= 0) {
|
||||||
|
// The selected model is visible in the current filter
|
||||||
|
selectedModelIdx = selectedInFiltered;
|
||||||
|
} else {
|
||||||
|
// The selected model is not visible, default to first item in filtered list
|
||||||
|
selectedModelIdx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
await tick();
|
||||||
|
const item = document.querySelector(`[data-arrow-selected="true"]`);
|
||||||
|
item?.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'instant' });
|
||||||
|
};
|
||||||
|
|
||||||
const pullModelHandler = async () => {
|
const pullModelHandler = async () => {
|
||||||
const sanitizedModelTag = searchValue.trim().replace(/^ollama\s+(run|pull)\s+/, '');
|
const sanitizedModelTag = searchValue.trim().replace(/^ollama\s+(run|pull)\s+/, '');
|
||||||
|
|
||||||
@ -290,39 +310,9 @@
|
|||||||
bind:open={show}
|
bind:open={show}
|
||||||
onOpenChange={async () => {
|
onOpenChange={async () => {
|
||||||
searchValue = '';
|
searchValue = '';
|
||||||
// Do NOT reset filters - keep the previously selected tag/connection type
|
window.setTimeout(() => document.getElementById('model-search-input')?.focus(), 0);
|
||||||
|
|
||||||
await tick();
|
resetView();
|
||||||
|
|
||||||
// First check if the currently selected model is visible in the filtered list
|
|
||||||
const selectedInFiltered = filteredItems.findIndex((item) => item.value === value);
|
|
||||||
|
|
||||||
if (selectedInFiltered >= 0) {
|
|
||||||
// The selected model is visible in the current filter
|
|
||||||
selectedModelIdx = selectedInFiltered;
|
|
||||||
} else {
|
|
||||||
// The selected model is not visible, default to first item in filtered list
|
|
||||||
selectedModelIdx = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
await tick();
|
|
||||||
|
|
||||||
// Scroll to the selected item if it exists in the current filtered view
|
|
||||||
const itemToScrollTo =
|
|
||||||
selectedInFiltered >= 0
|
|
||||||
? document.querySelector(`[data-value="${value}"]`)
|
|
||||||
: document.querySelector('[data-arrow-selected="true"]');
|
|
||||||
|
|
||||||
if (itemToScrollTo) {
|
|
||||||
const container = itemToScrollTo.closest('.overflow-y-auto');
|
|
||||||
if (container) {
|
|
||||||
const itemTop = itemToScrollTo.offsetTop;
|
|
||||||
const containerHeight = container.clientHeight;
|
|
||||||
const itemHeight = itemToScrollTo.clientHeight;
|
|
||||||
|
|
||||||
container.scrollTop = itemTop - containerHeight / 2 + itemHeight / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
closeFocus={false}
|
closeFocus={false}
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user