Skip to content

Commit

Permalink
Merge pull request #1721 from ashrafchowdury/fix/1717-select-model-co…
Browse files Browse the repository at this point in the history
…mponent-searchbar

Fix: select model component search bar
  • Loading branch information
aakrem authored May 30, 2024
2 parents 5bf37a7 + 5c1716c commit 7158b3f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
14 changes: 1 addition & 13 deletions agenta-web/src/components/Playground/Views/GroupedSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,8 @@ const iconMap: {[key: string]: React.ComponentType<any>} = {
Gemini: Gemini.Color,
}

const getTextContent = (element: React.ReactNode): string => {
if (typeof element === "string") {
return element
} else if (React.isValidElement(element) && element.props.children) {
return React.Children.toArray(element.props.children).reduce<string>(
(acc, child) => acc + getTextContent(child),
"",
)
}
return ""
}

const filterOption = (input: string, option?: {label: React.ReactNode; value: string}) =>
getTextContent(option?.label).toLowerCase().includes(input.toLowerCase())
(option?.value ?? "").toLowerCase().includes(input.toLowerCase())

export const ModelName: React.FC<{label: string; value: string}> = ({label, value}) => {
const classes = useStyles()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ABTestingEvaluationTable from "@/components/EvaluationTable/ABTestingEvaluationTable"
import {Evaluation} from "@/lib/Types"
import type {Evaluation} from "@/lib/Types"
import {loadEvaluation, loadEvaluationsScenarios, loadTestset} from "@/lib/services/api"
import {useRouter} from "next/router"
import {useEffect, useState} from "react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Evaluation, EvaluationScenario, GenericObject} from "@/lib/Types"
import type {Evaluation, EvaluationScenario, GenericObject} from "@/lib/Types"
import {loadEvaluation, loadEvaluationsScenarios, loadTestset} from "@/lib/services/api"
import {useRouter} from "next/router"
import {useEffect, useState} from "react"
Expand Down

0 comments on commit 7158b3f

Please sign in to comment.