Skip to content

Commit 631ed55

Browse files
authored
Fix custom preset display (#2562)
fix #2544 The problem is the `model_id` in `work_parameters` is not the same as the name in `ModelInfo`. So I assume all models have the same preset config.
1 parent 9742903 commit 631ed55

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

website/src/components/Chat/WorkParameters.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { memo } from "react";
55
import { JsonCard } from "src/components/JsonCard";
66
import { InferenceMessage, SamplingParameters } from "src/types/Chat";
77

8-
import { useChatContext } from "./ChatContext";
9-
108
export const areParametersEqual = (a: SamplingParameters, b: SamplingParameters) => {
119
return (
1210
a.top_k === b.top_k &&
@@ -24,14 +22,8 @@ export const WorkParametersDisplay = memo(function WorkParametersDisplay({
2422
parameters: NonNullable<InferenceMessage["work_parameters"]>;
2523
}) {
2624
const { seed: _, ...rest } = parameters;
27-
const model_id = parameters.model_config.model_id;
25+
const model_id = parameters.model_config.model_id.replace("OpenAssistant/", "");
2826
const { t } = useTranslation("chat");
29-
const { modelInfos } = useChatContext();
30-
const modelInfo = modelInfos.find((modelInfo) => modelInfo.name === model_id);
31-
const presetName =
32-
modelInfo?.parameter_configs.find((preset) =>
33-
areParametersEqual(preset.sampling_parameters, parameters.sampling_parameters)
34-
)?.name ?? t("preset_custom");
3527

3628
return (
3729
<>
@@ -59,12 +51,6 @@ export const WorkParametersDisplay = memo(function WorkParametersDisplay({
5951
{model_id}
6052
</Text>
6153
</span>
62-
<span>
63-
{t("preset")}:{" "}
64-
<Text as="span" fontWeight="medium">
65-
{presetName}
66-
</Text>
67-
</span>
6854
</Flex>
6955
<AccordionButton
7056
as={ChevronDown}

0 commit comments

Comments
 (0)