選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

cross-language-item-ui.tsx 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { FormLabel } from '@/components/ui/form';
  2. import { MultiSelect } from '@/components/ui/multi-select';
  3. import { useTranslation } from 'react-i18next';
  4. const Languages = [
  5. 'English',
  6. 'Chinese',
  7. 'Spanish',
  8. 'French',
  9. 'German',
  10. 'Japanese',
  11. 'Korean',
  12. 'Vietnamese',
  13. ];
  14. const options = Languages.map((x) => ({ label: x, value: x }));
  15. type CrossLanguageItemProps = {
  16. name?: string | Array<string>;
  17. onChange: (arg: string[]) => void;
  18. };
  19. export const CrossLanguageItem = ({
  20. name = ['prompt_config', 'cross_languages'],
  21. onChange = () => {},
  22. }: CrossLanguageItemProps) => {
  23. const { t } = useTranslation();
  24. return (
  25. <div>
  26. <div className="pb-2">
  27. <FormLabel tooltip={t('chat.crossLanguageTip')}>
  28. {t('chat.crossLanguage')}
  29. </FormLabel>
  30. </div>
  31. <MultiSelect
  32. options={options}
  33. onValueChange={(val) => {
  34. onChange(val);
  35. }}
  36. // defaultValue={field.value}
  37. placeholder={t('fileManager.pleaseSelect')}
  38. maxCount={100}
  39. // {...field}
  40. modalPopover
  41. />
  42. </div>
  43. );
  44. };