Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: select model component search bar #1721

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
aakrem marked this conversation as resolved.
Show resolved Hide resolved
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
Loading