misc improvements. need to add max h on thread histroy

This commit is contained in:
Andrew Pareles 2024-12-17 01:55:32 -08:00
parent 7752278720
commit d618223289
2 changed files with 7 additions and 7 deletions

View file

@ -27,7 +27,7 @@ export const SidebarThreadSelector = () => {
const sortedThreadIds = Object.keys(allThreads ?? {}).sort((threadId1, threadId2) => allThreads![threadId1].lastModified > allThreads![threadId2].lastModified ? -1 : 1)
return (
<div className="flex flex-col gap-y-1 overflow-y-auto h-[30vh]">
<div className="flex flex-col gap-y-1 overflow-y-auto">
{/* X button at top right */}
<div className="text-right">
@ -49,7 +49,7 @@ export const SidebarThreadSelector = () => {
</div>
{/* a list of all the past threads */}
<div className='flex flex-col gap-y-1 max-h-80 overflow-y-auto'>
<div className='flex flex-col gap-y-1 overflow-y-auto'>
{sortedThreadIds.map((threadId) => {
if (!allThreads)
return <>Error: Threads not found.</>

View file

@ -1,4 +1,4 @@
import React, { useCallback, useRef, useState } from 'react'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js'
import { ProviderName, SettingName, displayInfoOfSettingName, titleOfProviderName, providerNames, ModelInfo } from '../../../../../../../platform/void/common/voidSettingsTypes.js'
import ErrorBoundary from '../sidebar-tsx/ErrorBoundary.js'
@ -36,7 +36,7 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => {
const [errorString, setErrorString] = useState('')
const providerOptions = providerNames.map(providerName => ({ text: titleOfProviderName(providerName), value: providerName }))
const providerOptions = useMemo(() => providerNames.map(providerName => ({ text: titleOfProviderName(providerName), value: providerName })), [providerNames])
return <>
<div className='flex justify-center items-center gap-4'>
@ -44,7 +44,7 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => {
<div className='max-w-40 w-full'>
<VoidInputBox
placeholder='Model Name'
onChangeText={(modelName) => { modelNameRef.current = modelName }}
onChangeText={useCallback((modelName) => { modelNameRef.current = modelName }, [])}
multiline={false}
/>
</div>
@ -52,8 +52,8 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => {
{/* provider */}
<div className='max-w-40 w-full'>
<VoidSelectBox
onCreateInstance={(instance) => { providerNameRef.current = providerOptions[0].value }} // initialize state
onChangeSelection={(providerName: ProviderName) => { console.log('selecting provider', providerName); providerNameRef.current = providerName }}
onCreateInstance={useCallback(() => { providerNameRef.current = providerOptions[0].value }, [providerOptions])} // initialize state
onChangeSelection={useCallback((providerName: ProviderName) => { providerNameRef.current = providerName }, [])}
options={providerOptions}
/>
</div>