mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
fix: ensure custom params are not passed to non custom models
This commit is contained in:
parent
6e32f71565
commit
796d8031e8
10 changed files with 503 additions and 151 deletions
|
|
@ -11,22 +11,23 @@ import { increasePage, decreasePage, setPage, setConvos, setPages } from '~/stor
|
|||
export default function Nav({ navVisible, setNavVisible }) {
|
||||
const dispatch = useDispatch();
|
||||
const [isHovering, setIsHovering] = useState(false);
|
||||
const { conversationId, convos, pages, pageNumber, refreshConvoHint } = useSelector((state) => state.convo);
|
||||
const { conversationId, convos, pages, pageNumber, refreshConvoHint } = useSelector(
|
||||
(state) => state.convo
|
||||
);
|
||||
const onSuccess = (data) => {
|
||||
const { conversations, pages } = data;
|
||||
|
||||
if (pageNumber > pages)
|
||||
if (pageNumber > pages) {
|
||||
dispatch(setPage(pages));
|
||||
else
|
||||
} else {
|
||||
dispatch(setConvos(conversations));
|
||||
dispatch(setPages(pages));
|
||||
dispatch(setPages(pages));
|
||||
}
|
||||
};
|
||||
|
||||
const { data, isLoading, mutate } = swr(
|
||||
`/api/convos?pageNumber=${pageNumber}`,
|
||||
onSuccess,
|
||||
{revalidateOnMount: false}
|
||||
);
|
||||
const { data, isLoading, mutate } = swr(`/api/convos?pageNumber=${pageNumber}`, onSuccess, {
|
||||
revalidateOnMount: false
|
||||
});
|
||||
|
||||
const containerRef = useRef(null);
|
||||
const scrollPositionRef = useRef(null);
|
||||
|
|
@ -36,23 +37,25 @@ export default function Nav({ navVisible, setNavVisible }) {
|
|||
if (container) {
|
||||
scrollPositionRef.current = container.scrollTop;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const nextPage = async () => {
|
||||
moveToTop()
|
||||
moveToTop();
|
||||
|
||||
dispatch(increasePage());
|
||||
await mutate();
|
||||
};
|
||||
|
||||
const previousPage = async () => {
|
||||
moveToTop()
|
||||
|
||||
moveToTop();
|
||||
|
||||
dispatch(decreasePage());
|
||||
await mutate();
|
||||
};
|
||||
|
||||
useEffect(() => {mutate()}, [pageNumber, conversationId, refreshConvoHint]);
|
||||
useEffect(() => {
|
||||
mutate();
|
||||
}, [pageNumber, conversationId, refreshConvoHint]);
|
||||
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
|
|
@ -66,14 +69,14 @@ export default function Nav({ navVisible, setNavVisible }) {
|
|||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
setNavVisible(false)
|
||||
}, [conversationId, ])
|
||||
setNavVisible(false);
|
||||
}, [conversationId]);
|
||||
|
||||
const toggleNavVisible = () => {
|
||||
setNavVisible((prev) => {
|
||||
return !prev
|
||||
})
|
||||
}
|
||||
return !prev;
|
||||
});
|
||||
};
|
||||
|
||||
const containerClasses =
|
||||
isLoading && pageNumber === 1
|
||||
|
|
@ -82,7 +85,12 @@ export default function Nav({ navVisible, setNavVisible }) {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div className={"dark nav bg-gray-900 md:fixed md:inset-y-0 md:flex md:w-[260px] md:flex-col" + (navVisible?' active':'')}>
|
||||
<div
|
||||
className={
|
||||
'nav dark bg-gray-900 md:fixed md:inset-y-0 md:flex md:w-[260px] md:flex-col' +
|
||||
(navVisible ? ' active' : '')
|
||||
}
|
||||
>
|
||||
<div className="flex h-full min-h-0 flex-col ">
|
||||
<div className="scrollbar-trigger flex h-full w-full flex-1 items-start border-white/20">
|
||||
<nav className="flex h-full flex-1 flex-col space-y-1 p-2">
|
||||
|
|
@ -117,7 +125,7 @@ export default function Nav({ navVisible, setNavVisible }) {
|
|||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="nav-close-button -ml-0.5 -mt-0.5 inline-flex h-10 w-10 items-center justify-center rounded-md hover:text-gray-900 focus:outline-none focus:ring-white hover:text-white text-white"
|
||||
className="nav-close-button -ml-0.5 -mt-0.5 inline-flex h-10 w-10 items-center justify-center rounded-md text-white hover:text-gray-900 hover:text-white focus:outline-none focus:ring-white"
|
||||
onClick={toggleNavVisible}
|
||||
>
|
||||
<span className="sr-only">Open sidebar</span>
|
||||
|
|
@ -148,8 +156,10 @@ export default function Nav({ navVisible, setNavVisible }) {
|
|||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div className={"nav-mask" + (navVisible?' active':'')} onClick={toggleNavVisible}>
|
||||
</div>
|
||||
<div
|
||||
className={'nav-mask' + (navVisible ? ' active' : '')}
|
||||
onClick={toggleNavVisible}
|
||||
></div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue