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.

index.tsx 15KB

2 years ago
2 years ago
2 years ago
2 years ago
Introduce Plugins (#13836) Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
8 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. 'use client'
  2. import { useState } from 'react'
  3. import { useMount } from 'ahooks'
  4. import { useContext } from 'use-context-selector'
  5. import { useTranslation } from 'react-i18next'
  6. import { useSWRConfig } from 'swr'
  7. import { unstable_serialize } from 'swr/infinite'
  8. import PermissionSelector from '../permission-selector'
  9. import IndexMethodRadio from '../index-method-radio'
  10. import RetrievalSettings from '../../external-knowledge-base/create/RetrievalSettings'
  11. import { IndexingType } from '../../create/step-two'
  12. import RetrievalMethodConfig from '@/app/components/datasets/common/retrieval-method-config'
  13. import EconomicalRetrievalMethodConfig from '@/app/components/datasets/common/economical-retrieval-method-config'
  14. import { ToastContext } from '@/app/components/base/toast'
  15. import Button from '@/app/components/base/button'
  16. import Input from '@/app/components/base/input'
  17. import Textarea from '@/app/components/base/textarea'
  18. import { ApiConnectionMod } from '@/app/components/base/icons/src/vender/solid/development'
  19. import { updateDatasetSetting } from '@/service/datasets'
  20. import { type DataSetListResponse, DatasetPermission } from '@/models/datasets'
  21. import DatasetDetailContext from '@/context/dataset-detail'
  22. import type { RetrievalConfig } from '@/types/app'
  23. import { useAppContext } from '@/context/app-context'
  24. import { isReRankModelSelected } from '@/app/components/datasets/common/check-rerank-model'
  25. import ModelSelector from '@/app/components/header/account-setting/model-provider-page/model-selector'
  26. import {
  27. useModelList,
  28. useModelListAndDefaultModelAndCurrentProviderAndModel,
  29. } from '@/app/components/header/account-setting/model-provider-page/hooks'
  30. import type { DefaultModel } from '@/app/components/header/account-setting/model-provider-page/declarations'
  31. import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
  32. import { fetchMembers } from '@/service/common'
  33. import type { Member } from '@/models/common'
  34. import AlertTriangle from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback/AlertTriangle'
  35. const rowClass = 'flex'
  36. const labelClass = `
  37. flex items-center shrink-0 w-[180px] h-9
  38. `
  39. const getKey = (pageIndex: number, previousPageData: DataSetListResponse) => {
  40. if (!pageIndex || previousPageData.has_more)
  41. return { url: 'datasets', params: { page: pageIndex + 1, limit: 30 } }
  42. return null
  43. }
  44. const Form = () => {
  45. const { t } = useTranslation()
  46. const { notify } = useContext(ToastContext)
  47. const { mutate } = useSWRConfig()
  48. const { isCurrentWorkspaceDatasetOperator } = useAppContext()
  49. const { dataset: currentDataset, mutateDatasetRes: mutateDatasets } = useContext(DatasetDetailContext)
  50. const [loading, setLoading] = useState(false)
  51. const [name, setName] = useState(currentDataset?.name ?? '')
  52. const [description, setDescription] = useState(currentDataset?.description ?? '')
  53. const [permission, setPermission] = useState(currentDataset?.permission)
  54. const [topK, setTopK] = useState(currentDataset?.external_retrieval_model.top_k ?? 2)
  55. const [scoreThreshold, setScoreThreshold] = useState(currentDataset?.external_retrieval_model.score_threshold ?? 0.5)
  56. const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(currentDataset?.external_retrieval_model.score_threshold_enabled ?? false)
  57. const [selectedMemberIDs, setSelectedMemberIDs] = useState<string[]>(currentDataset?.partial_member_list || [])
  58. const [memberList, setMemberList] = useState<Member[]>([])
  59. const [indexMethod, setIndexMethod] = useState(currentDataset?.indexing_technique)
  60. const [retrievalConfig, setRetrievalConfig] = useState(currentDataset?.retrieval_model_dict as RetrievalConfig)
  61. const [embeddingModel, setEmbeddingModel] = useState<DefaultModel>(
  62. currentDataset?.embedding_model
  63. ? {
  64. provider: currentDataset.embedding_model_provider,
  65. model: currentDataset.embedding_model,
  66. }
  67. : {
  68. provider: '',
  69. model: '',
  70. },
  71. )
  72. const {
  73. modelList: rerankModelList,
  74. } = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
  75. const { data: embeddingModelList } = useModelList(ModelTypeEnum.textEmbedding)
  76. const getMembers = async () => {
  77. const { accounts } = await fetchMembers({ url: '/workspaces/current/members', params: {} })
  78. if (!accounts)
  79. setMemberList([])
  80. else
  81. setMemberList(accounts)
  82. }
  83. const handleSettingsChange = (data: { top_k?: number; score_threshold?: number; score_threshold_enabled?: boolean }) => {
  84. if (data.top_k !== undefined)
  85. setTopK(data.top_k)
  86. if (data.score_threshold !== undefined)
  87. setScoreThreshold(data.score_threshold)
  88. if (data.score_threshold_enabled !== undefined)
  89. setScoreThresholdEnabled(data.score_threshold_enabled)
  90. }
  91. useMount(() => {
  92. getMembers()
  93. })
  94. const handleSave = async () => {
  95. if (loading)
  96. return
  97. if (!name?.trim()) {
  98. notify({ type: 'error', message: t('datasetSettings.form.nameError') })
  99. return
  100. }
  101. if (
  102. !isReRankModelSelected({
  103. rerankModelList,
  104. retrievalConfig,
  105. indexMethod,
  106. })
  107. ) {
  108. notify({ type: 'error', message: t('appDebug.datasetConfig.rerankModelRequired') })
  109. return
  110. }
  111. if (retrievalConfig.weights) {
  112. retrievalConfig.weights.vector_setting.embedding_provider_name = currentDataset?.embedding_model_provider || ''
  113. retrievalConfig.weights.vector_setting.embedding_model_name = currentDataset?.embedding_model || ''
  114. }
  115. try {
  116. setLoading(true)
  117. const requestParams = {
  118. datasetId: currentDataset!.id,
  119. body: {
  120. name,
  121. description,
  122. permission,
  123. indexing_technique: indexMethod,
  124. retrieval_model: {
  125. ...retrievalConfig,
  126. score_threshold: retrievalConfig.score_threshold_enabled ? retrievalConfig.score_threshold : 0,
  127. },
  128. embedding_model: embeddingModel.model,
  129. embedding_model_provider: embeddingModel.provider,
  130. ...(currentDataset!.provider === 'external' && {
  131. external_knowledge_id: currentDataset!.external_knowledge_info.external_knowledge_id,
  132. external_knowledge_api_id: currentDataset!.external_knowledge_info.external_knowledge_api_id,
  133. external_retrieval_model: {
  134. top_k: topK,
  135. score_threshold: scoreThreshold,
  136. score_threshold_enabled: scoreThresholdEnabled,
  137. },
  138. }),
  139. },
  140. } as any
  141. if (permission === DatasetPermission.partialMembers) {
  142. requestParams.body.partial_member_list = selectedMemberIDs.map((id) => {
  143. return {
  144. user_id: id,
  145. role: memberList.find(member => member.id === id)?.role,
  146. }
  147. })
  148. }
  149. await updateDatasetSetting(requestParams)
  150. notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
  151. if (mutateDatasets) {
  152. await mutateDatasets()
  153. mutate(unstable_serialize(getKey))
  154. }
  155. }
  156. catch {
  157. notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
  158. }
  159. finally {
  160. setLoading(false)
  161. }
  162. }
  163. return (
  164. <div className='flex w-full flex-col gap-y-4 px-14 py-8 sm:w-[880px]'>
  165. <div className={rowClass}>
  166. <div className={labelClass}>
  167. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.name')}</div>
  168. </div>
  169. <div className='grow'>
  170. <Input
  171. disabled={!currentDataset?.embedding_available}
  172. className='h-9'
  173. value={name}
  174. onChange={e => setName(e.target.value)}
  175. />
  176. </div>
  177. </div>
  178. <div className={rowClass}>
  179. <div className={labelClass}>
  180. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.desc')}</div>
  181. </div>
  182. <div className='grow'>
  183. <Textarea
  184. disabled={!currentDataset?.embedding_available}
  185. className='h-[120px] resize-none'
  186. placeholder={t('datasetSettings.form.descPlaceholder') || ''}
  187. value={description}
  188. onChange={e => setDescription(e.target.value)}
  189. />
  190. </div>
  191. </div>
  192. <div className={rowClass}>
  193. <div className={labelClass}>
  194. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.permissions')}</div>
  195. </div>
  196. <div className='grow'>
  197. <PermissionSelector
  198. disabled={!currentDataset?.embedding_available || isCurrentWorkspaceDatasetOperator}
  199. permission={permission}
  200. value={selectedMemberIDs}
  201. onChange={v => setPermission(v)}
  202. onMemberSelect={setSelectedMemberIDs}
  203. memberList={memberList}
  204. />
  205. </div>
  206. </div>
  207. {currentDataset && currentDataset.indexing_technique && (
  208. <>
  209. <div className='my-1 h-0 w-full border-b border-divider-subtle' />
  210. <div className={rowClass}>
  211. <div className={labelClass}>
  212. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.indexMethod')}</div>
  213. </div>
  214. <div className='grow'>
  215. <IndexMethodRadio
  216. disable={!currentDataset?.embedding_available}
  217. value={indexMethod}
  218. onChange={v => setIndexMethod(v!)}
  219. docForm={currentDataset.doc_form}
  220. currentValue={currentDataset.indexing_technique}
  221. />
  222. {currentDataset.indexing_technique === IndexingType.ECONOMICAL && indexMethod === IndexingType.QUALIFIED && <div className='mt-2 flex h-10 items-center gap-x-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs backdrop-blur-[5px]'>
  223. <div className='absolute bottom-0 left-0 right-0 top-0 bg-[linear-gradient(92deg,rgba(247,144,9,0.25)_0%,rgba(255,255,255,0.00)_100%)] opacity-40'></div>
  224. <div className='p-1'>
  225. <AlertTriangle className='size-4 text-text-warning-secondary' />
  226. </div>
  227. <span className='system-xs-medium text-text-warning-secondary'>{t('datasetSettings.form.upgradeHighQualityTip')}</span>
  228. </div>}
  229. </div>
  230. </div>
  231. </>
  232. )}
  233. {indexMethod === 'high_quality' && (
  234. <>
  235. <div className={rowClass}>
  236. <div className={labelClass}>
  237. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.embeddingModel')}</div>
  238. </div>
  239. <div className='grow'>
  240. <ModelSelector
  241. triggerClassName=''
  242. defaultModel={embeddingModel}
  243. modelList={embeddingModelList}
  244. onSelect={(model: DefaultModel) => {
  245. setEmbeddingModel(model)
  246. }}
  247. />
  248. </div>
  249. </div>
  250. </>
  251. )}
  252. {/* Retrieval Method Config */}
  253. {currentDataset?.provider === 'external'
  254. ? <>
  255. <div className='my-1 h-0 w-full border-b border-divider-subtle' />
  256. <div className={rowClass}>
  257. <div className={labelClass}>
  258. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.retrievalSetting.title')}</div>
  259. </div>
  260. <RetrievalSettings
  261. topK={topK}
  262. scoreThreshold={scoreThreshold}
  263. scoreThresholdEnabled={scoreThresholdEnabled}
  264. onChange={handleSettingsChange}
  265. isInRetrievalSetting={true}
  266. />
  267. </div>
  268. <div className='my-1 h-0 w-full border-b border-divider-subtle' />
  269. <div className={rowClass}>
  270. <div className={labelClass}>
  271. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.externalKnowledgeAPI')}</div>
  272. </div>
  273. <div className='w-full'>
  274. <div className='flex h-full items-center gap-1 rounded-lg bg-components-input-bg-normal px-3 py-2'>
  275. <ApiConnectionMod className='h-4 w-4 text-text-secondary' />
  276. <div className='system-sm-medium overflow-hidden text-ellipsis text-text-secondary'>
  277. {currentDataset?.external_knowledge_info.external_knowledge_api_name}
  278. </div>
  279. <div className='system-xs-regular text-text-tertiary'>·</div>
  280. <div className='system-xs-regular text-text-tertiary'>{currentDataset?.external_knowledge_info.external_knowledge_api_endpoint}</div>
  281. </div>
  282. </div>
  283. </div>
  284. <div className={rowClass}>
  285. <div className={labelClass}>
  286. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.externalKnowledgeID')}</div>
  287. </div>
  288. <div className='w-full'>
  289. <div className='flex h-full items-center gap-1 rounded-lg bg-components-input-bg-normal px-3 py-2'>
  290. <div className='system-xs-regular text-text-tertiary'>{currentDataset?.external_knowledge_info.external_knowledge_id}</div>
  291. </div>
  292. </div>
  293. </div>
  294. </>
  295. : indexMethod
  296. ? <>
  297. <div className='my-1 h-0 w-full border-b border-divider-subtle' />
  298. <div className={rowClass}>
  299. <div className={labelClass}>
  300. <div>
  301. <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.retrievalSetting.title')}</div>
  302. <div className='body-xs-regular text-text-tertiary'>
  303. <a target='_blank' rel='noopener noreferrer' href='https://docs.dify.ai/guides/knowledge-base/create-knowledge-and-upload-documents#id-4-retrieval-settings' className='text-text-accent'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a>
  304. {t('datasetSettings.form.retrievalSetting.description')}
  305. </div>
  306. </div>
  307. </div>
  308. <div className='grow'>
  309. {indexMethod === IndexingType.QUALIFIED
  310. ? (
  311. <RetrievalMethodConfig
  312. value={retrievalConfig}
  313. onChange={setRetrievalConfig}
  314. />
  315. )
  316. : (
  317. <EconomicalRetrievalMethodConfig
  318. value={retrievalConfig}
  319. onChange={setRetrievalConfig}
  320. />
  321. )}
  322. </div>
  323. </div>
  324. </>
  325. : null
  326. }
  327. <div className='my-1 h-0 w-full border-b border-divider-subtle' />
  328. <div className={rowClass}>
  329. <div className={labelClass} />
  330. <div className='grow'>
  331. <Button
  332. className='min-w-24'
  333. variant='primary'
  334. loading={loading}
  335. disabled={loading}
  336. onClick={handleSave}
  337. >
  338. {t('datasetSettings.form.save')}
  339. </Button>
  340. </div>
  341. </div>
  342. </div>
  343. )
  344. }
  345. export default Form