This commit is contained in:
Saoud Rizwan
2024-10-04 04:48:14 -04:00
parent 916dceafab
commit d9ffff7cec

View File

@@ -18,6 +18,7 @@ const OpenRouterModelPicker: React.FC = () => {
const dropdownRef = useRef<HTMLDivElement>(null)
const itemRefs = useRef<(HTMLDivElement | null)[]>([])
const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false)
const dropdownListRef = useRef<HTMLDivElement>(null)
const handleModelChange = (newModelId: string) => {
setApiConfiguration({
@@ -112,6 +113,9 @@ const OpenRouterModelPicker: React.FC = () => {
useEffect(() => {
setSelectedIndex(-1)
if (dropdownListRef.current) {
dropdownListRef.current.scrollTop = 0
}
}, [searchTerm])
useEffect(() => {
@@ -168,7 +172,7 @@ const OpenRouterModelPicker: React.FC = () => {
)}
</VSCodeTextField>
{isDropdownVisible && (
<DropdownList>
<DropdownList ref={dropdownListRef}>
{modelSearchResults.map((item, index) => (
<DropdownItem
key={item.id}