You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chat-basic-settings.tsx 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. 'use client';
  2. import { FileUploader } from '@/components/file-uploader';
  3. import { KnowledgeBaseFormField } from '@/components/knowledge-base-item';
  4. import { SwitchFormField } from '@/components/switch-fom-field';
  5. import {
  6. FormControl,
  7. FormField,
  8. FormItem,
  9. FormLabel,
  10. FormMessage,
  11. } from '@/components/ui/form';
  12. import { Input } from '@/components/ui/input';
  13. import { Textarea } from '@/components/ui/textarea';
  14. import { useTranslate } from '@/hooks/common-hooks';
  15. import { useFormContext } from 'react-hook-form';
  16. export default function ChatBasicSetting() {
  17. const { t } = useTranslate('chat');
  18. const form = useFormContext();
  19. return (
  20. <div className="space-y-8">
  21. <FormField
  22. control={form.control}
  23. name={'icon'}
  24. render={({ field }) => (
  25. <div className="space-y-6">
  26. <FormItem className="w-full">
  27. <FormLabel>{t('assistantAvatar')}</FormLabel>
  28. <FormControl>
  29. <FileUploader
  30. value={field.value}
  31. onValueChange={field.onChange}
  32. maxFileCount={1}
  33. maxSize={4 * 1024 * 1024}
  34. />
  35. </FormControl>
  36. <FormMessage />
  37. </FormItem>
  38. </div>
  39. )}
  40. />
  41. <FormField
  42. control={form.control}
  43. name="name"
  44. render={({ field }) => (
  45. <FormItem>
  46. <FormLabel>{t('assistantName')}</FormLabel>
  47. <FormControl>
  48. <Input {...field}></Input>
  49. </FormControl>
  50. <FormMessage />
  51. </FormItem>
  52. )}
  53. />
  54. <FormField
  55. control={form.control}
  56. name="description"
  57. render={({ field }) => (
  58. <FormItem>
  59. <FormLabel>{t('description')}</FormLabel>
  60. <FormControl>
  61. <Textarea {...field}></Textarea>
  62. </FormControl>
  63. <FormMessage />
  64. </FormItem>
  65. )}
  66. />
  67. <FormField
  68. control={form.control}
  69. name={'prompt_config.empty_response'}
  70. render={({ field }) => (
  71. <FormItem>
  72. <FormLabel>{t('emptyResponse')}</FormLabel>
  73. <FormControl>
  74. <Textarea {...field}></Textarea>
  75. </FormControl>
  76. <FormMessage />
  77. </FormItem>
  78. )}
  79. />
  80. <FormField
  81. control={form.control}
  82. name={'prompt_config.prologue'}
  83. render={({ field }) => (
  84. <FormItem>
  85. <FormLabel>{t('setAnOpener')}</FormLabel>
  86. <FormControl>
  87. <Textarea {...field}></Textarea>
  88. </FormControl>
  89. <FormMessage />
  90. </FormItem>
  91. )}
  92. />
  93. <SwitchFormField
  94. name={'prompt_config.quote'}
  95. label={t('quote')}
  96. ></SwitchFormField>
  97. <SwitchFormField
  98. name={'prompt_config.keyword'}
  99. label={t('keyword')}
  100. ></SwitchFormField>
  101. <SwitchFormField
  102. name={'prompt_config.tts'}
  103. label={t('tts')}
  104. ></SwitchFormField>
  105. <KnowledgeBaseFormField></KnowledgeBaseFormField>
  106. </div>
  107. );
  108. }