diff --git a/api/server/controllers/FavoritesController.js b/api/server/controllers/FavoritesController.js index 4da84ff914..bca08035cf 100644 --- a/api/server/controllers/FavoritesController.js +++ b/api/server/controllers/FavoritesController.js @@ -37,10 +37,8 @@ const getFavoritesController = async (req, res) => { let favorites = user.favorites || []; - // Ensure favorites is an array (migration/dev fix) if (!Array.isArray(favorites)) { favorites = []; - // Optionally update the DB to fix it permanently await User.findByIdAndUpdate(userId, { $set: { favorites: [] } }); } diff --git a/client/src/components/Agents/AgentCard.tsx b/client/src/components/Agents/AgentCard.tsx index 5d9f13eeb6..751cab9b65 100644 --- a/client/src/components/Agents/AgentCard.tsx +++ b/client/src/components/Agents/AgentCard.tsx @@ -83,7 +83,7 @@ const AgentCard: React.FC = ({ agent, onClick, className = '' })

- {/* Owner info - moved to bottom right */} + {/* Owner info */} {(() => { const displayName = getContactDisplayName(agent); if (displayName) { diff --git a/client/src/components/Agents/AgentDetail.tsx b/client/src/components/Agents/AgentDetail.tsx index 4bd84df180..d05d1038ff 100644 --- a/client/src/components/Agents/AgentDetail.tsx +++ b/client/src/components/Agents/AgentDetail.tsx @@ -141,24 +141,24 @@ const AgentDetail: React.FC = ({ agent, isOpen, onClose }) => return ( !open && onClose()}> - {/* Agent avatar - top center */} + {/* Agent avatar */}
{renderAgentAvatar(agent, { size: 'xl' })}
- {/* Agent name - center aligned below image */} + {/* Agent name */}

{agent?.name || localize('com_agents_loading')}

- {/* Contact info - center aligned below name */} + {/* Contact info */} {agent?.support_contact && formatContact() && (
{localize('com_agents_contact')}: {formatContact()}
)} - {/* Agent description - below contact */} + {/* Agent description */}
{agent?.description}
diff --git a/client/src/components/Chat/Menus/Endpoints/ModelSelector.tsx b/client/src/components/Chat/Menus/Endpoints/ModelSelector.tsx index bee5a38ad4..71caf4a3db 100644 --- a/client/src/components/Chat/Menus/Endpoints/ModelSelector.tsx +++ b/client/src/components/Chat/Menus/Endpoints/ModelSelector.tsx @@ -28,7 +28,6 @@ function ModelSelectorContent() { searchValue, searchResults, selectedValues, - // Functions setSearchValue, setSelectedValues, diff --git a/client/src/components/Nav/Favorites/FavoritesList.tsx b/client/src/components/Nav/Favorites/FavoritesList.tsx index c061e23659..034bb36794 100644 --- a/client/src/components/Nav/Favorites/FavoritesList.tsx +++ b/client/src/components/Nav/Favorites/FavoritesList.tsx @@ -23,41 +23,43 @@ const DraggableFavoriteItem = ({ children, }: DraggableFavoriteItemProps) => { const ref = useRef(null); - const [{ handlerId }, drop] = useDrop({ - accept: 'favorite-item', - collect(monitor) { - return { - handlerId: monitor.getHandlerId(), - }; + const [{ handlerId }, drop] = useDrop<{ index: number; id: string }, unknown, { handlerId: any }>( + { + accept: 'favorite-item', + collect(monitor) { + return { + handlerId: monitor.getHandlerId(), + }; + }, + hover(item, monitor) { + if (!ref.current) { + return; + } + const dragIndex = item.index; + const hoverIndex = index; + + if (dragIndex === hoverIndex) { + return; + } + + const hoverBoundingRect = ref.current?.getBoundingClientRect(); + const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2; + const clientOffset = monitor.getClientOffset(); + const hoverClientY = (clientOffset as any).y - hoverBoundingRect.top; + + if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) { + return; + } + + if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) { + return; + } + + moveItem(dragIndex, hoverIndex); + item.index = hoverIndex; + }, }, - hover(item: { index: number; id: string }, monitor) { - if (!ref.current) { - return; - } - const dragIndex = item.index; - const hoverIndex = index; - - if (dragIndex === hoverIndex) { - return; - } - - const hoverBoundingRect = ref.current?.getBoundingClientRect(); - const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2; - const clientOffset = monitor.getClientOffset(); - const hoverClientY = (clientOffset as any).y - hoverBoundingRect.top; - - if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) { - return; - } - - if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) { - return; - } - - moveItem(dragIndex, hoverIndex); - item.index = hoverIndex; - }, - }); + ); const [{ isDragging }, drag] = useDrag({ type: 'favorite-item', diff --git a/client/src/data-provider/Favorites.ts b/client/src/data-provider/Favorites.ts index 539b354602..56cda59d8c 100644 --- a/client/src/data-provider/Favorites.ts +++ b/client/src/data-provider/Favorites.ts @@ -3,18 +3,23 @@ import { dataService } from 'librechat-data-provider'; import type { FavoritesState } from '~/store/favorites'; export const useGetFavoritesQuery = (config?: any) => { - return useQuery(['favorites'], () => dataService.getFavorites() as Promise, { - refetchOnWindowFocus: false, - refetchOnReconnect: false, - refetchOnMount: false, - ...config, - }); + return useQuery( + ['favorites'], + () => dataService.getFavorites() as Promise, + { + refetchOnWindowFocus: false, + refetchOnReconnect: false, + refetchOnMount: false, + ...config, + }, + ); }; export const useUpdateFavoritesMutation = () => { const queryClient = useQueryClient(); return useMutation( - (favorites: FavoritesState) => dataService.updateFavorites(favorites) as Promise, + (favorites: FavoritesState) => + dataService.updateFavorites(favorites) as Promise, { onSuccess: (data) => { queryClient.setQueryData(['favorites'], data); diff --git a/package-lock.json b/package-lock.json index c76663fd96..39679faa5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47913,7 +47913,7 @@ }, "packages/data-schemas": { "name": "@librechat/data-schemas", - "version": "0.0.30", + "version": "0.0.31", "license": "MIT", "devDependencies": { "@rollup/plugin-alias": "^5.1.0", diff --git a/packages/data-schemas/package.json b/packages/data-schemas/package.json index 0cbe5c29d5..de8531ff1d 100644 --- a/packages/data-schemas/package.json +++ b/packages/data-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@librechat/data-schemas", - "version": "0.0.30", + "version": "0.0.31", "description": "Mongoose schemas and models for LibreChat", "type": "module", "main": "dist/index.cjs", diff --git a/packages/data-schemas/src/types/user.ts b/packages/data-schemas/src/types/user.ts index 88ab38ffbc..cd26026987 100644 --- a/packages/data-schemas/src/types/user.ts +++ b/packages/data-schemas/src/types/user.ts @@ -39,7 +39,6 @@ export interface IUser extends Document { models: Array<{ model: string; endpoint: string; - label?: string; }>; }; createdAt?: Date;