Feat: Fixed the chat model setting echo issue (#9521)

### What problem does this PR solve?

Feat: Fixed the chat model setting echo issue

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-08-18 12:03:33 +08:00
committed by GitHub
parent fb77f9917b
commit b08650bc4c
6 changed files with 88 additions and 25 deletions

View File

@ -30,3 +30,22 @@ export const removeUselessFieldsFromValues = (values: any, prefix?: string) => {
export function buildOptions(data: Record<string, any>) {
return Object.values(data).map((val) => ({ label: val, value: val }));
}
export function setLLMSettingEnabledValues(
initialLlmSetting?: Record<string, any>,
) {
const values = Object.keys(variableEnabledFieldMap).reduce<
Record<string, boolean>
>((pre, field) => {
pre[field] =
initialLlmSetting === undefined
? false
: !!initialLlmSetting[
variableEnabledFieldMap[
field as keyof typeof variableEnabledFieldMap
]
];
return pre;
}, {});
return values;
}