Skip to content

Commit

Permalink
fix: retreiver selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Blakeinstein committed Nov 26, 2024
1 parent a349390 commit 0bf79cd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { MenuItem, Select } from '@mui/material'
import { FormControl, MenuItem, Select } from '@mui/material'

interface ConfigProps {
title: string
Expand All @@ -25,31 +25,33 @@ const ConfigSelector = (props: ConfigProps) => {
return (
<div className={`flex justify-between items-center ${className}`}>
<div className="text-sm">{title}:</div>
<Select
value={initialValue}
onChange={(e) => handleOnChange(e)}
placeholder={placeholder + '...'}
sx={{
background: 'white',
height: '2rem',
width: '13.1875rem',
border: '1px solid #CEE0F8 !important',
outline: 'none !important',
'& fieldset': {
border: 'none !important',
},
}}
>
{data?.map((item: any) =>
renderItem ? (
renderItem(item)
) : (
<MenuItem value={item} key={item}>
{item}
</MenuItem>
),
)}
</Select>
<FormControl>
<Select
value={initialValue}
onChange={(e) => handleOnChange(e)}
label={placeholder + '...'}
sx={{
background: 'white',
height: '2rem',
width: '13.1875rem',
border: '1px solid #CEE0F8 !important',
outline: 'none !important',
'& fieldset': {
border: 'none !important',
},
}}
>
{data?.map((item: any) =>
renderItem ? (
renderItem(item)
) : (
<MenuItem value={item} key={item}>
{item}
</MenuItem>
),
)}
</Select>
</FormControl>
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,20 @@ const Left = (props: any) => {
{allRetrieverOptions && selectedRetriever?.key && (
<ConfigSelector
title="Retriever"
placeholder="Select Retriever..."
initialValue={selectedRetriever?.summary}
placeholder="Select Retriever"
initialValue={selectedRetriever?.key}
data={allRetrieverOptions}
className="mt-4"
handleOnChange={(e) => {
console.log(allRetrieverOptions.map((retriever) => retriever.key))
const retriever = allRetrieverOptions.find(
(retriever) => retriever.key === e.target.value,
)
setSelectedRetriever(retriever)
setPromptTemplate(retriever?.promptTemplate)
}}
renderItem={(item) => (
<MenuItem key={item.key} value={item.summary}>
<MenuItem key={item.key} value={item.key}>
{item.summary}
</MenuItem>
)}
Expand Down

0 comments on commit 0bf79cd

Please sign in to comment.