Fix: Optimize the MultiSelect component and system prompt templates #3221 (#9752)

### What problem does this PR solve?

Fix: Optimize the MultiSelect component and system prompt templates
#3221

- Modify the conditional statements in the MultiSelect component, using
the ?. operator to improve code readability
- Optimize the formatting of the system prompt template to make it more
standardized and easier to read
- Update the Chinese translation, changing "ExeSQL" to "Execute SQL"

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
chanx
2025-08-27 15:12:12 +08:00
committed by GitHub
parent cbdabbb58f
commit ff11348f7c
3 changed files with 20 additions and 18 deletions

View File

@ -209,13 +209,13 @@ export const MultiSelect = React.forwardRef<
const [isAnimating, setIsAnimating] = React.useState(false);
React.useEffect(() => {
if (!selectedValues && props.value) {
if (!selectedValues?.length && props.value) {
setSelectedValues(props.value as string[]);
}
}, [props.value, selectedValues]);
React.useEffect(() => {
if (!selectedValues && !props.value && defaultValue) {
if (!selectedValues?.length && !props.value && defaultValue) {
setSelectedValues(defaultValue);
}
}, [defaultValue, props.value, selectedValues]);