config.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div class="main-container">
  3. <div style="position: absolute;top: 0;left: 0;width: 100%;padding: 0 20px">
  4. <h4 style="margin-bottom: 10px">配置</h4>
  5. <div style="color: #666666;">在这里更新您的知识库详细信息,尤其是解析方法。</div>
  6. <a-divider style="margin-top: 20px" />
  7. </div>
  8. <div class="main-container-lf">
  9. <div class="main-container-lf-down">
  10. <a-form ref="formRef" :size="form.size" :model="form" :style="{width:'100%'}" layout="vertical"
  11. @submit="handleSubmit">
  12. <a-form-item field="name" label="知识库名称"
  13. :rules="[{required:true,message:'name is required'},{minLength:5,message:'must be greater than 5 characters'}]"
  14. :validate-trigger="['change','input']"
  15. >
  16. <a-input v-model="form.name" placeholder="请输入" />
  17. </a-form-item>
  18. <a-form-item field="section" label="知识库图片">
  19. <a-space direction="vertical" :style="{ width: '100%' }">
  20. <a-upload
  21. action="/"
  22. :fileList="file ? [file] : []"
  23. :show-file-list="false"
  24. @change="onChange"
  25. @progress="onProgress"
  26. >
  27. <template #upload-button>
  28. <div
  29. :class="`arco-upload-list-item${
  30. file && file.status === 'error' ? ' arco-upload-list-item-error' : ''
  31. }`"
  32. >
  33. <div
  34. class="arco-upload-list-picture custom-upload-avatar"
  35. v-if="file && file.url"
  36. >
  37. <img :src="file.url" />
  38. <div class="arco-upload-list-picture-mask">
  39. <IconEdit />
  40. </div>
  41. <a-progress
  42. v-if="file.status === 'uploading' && file.percent < 100"
  43. :percent="file.percent"
  44. type="circle"
  45. size="mini"
  46. :style="{
  47. position: 'absolute',
  48. left: '50%',
  49. top: '50%',
  50. transform: 'translateX(-50%) translateY(-50%)',
  51. }"
  52. />
  53. </div>
  54. <div class="arco-upload-picture-card" v-else>
  55. <div class="arco-upload-picture-card-text">
  56. <IconPlus />
  57. <div style="margin-top: 10px; font-weight: 600">上传</div>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. </a-upload>
  63. </a-space>
  64. </a-form-item>
  65. <a-form-item field="section" label="描述">
  66. <a-textarea placeholder="" allow-clear />
  67. </a-form-item>
  68. <a-form-item field="section" label="语言" :rules="[{match:/section one/,message:'请选择'}]">
  69. <a-select v-model="form.section" placeholder="请选择" allow-clear>
  70. <a-option value="0">中文</a-option>
  71. <a-option value="1">英文</a-option>
  72. </a-select>
  73. </a-form-item>
  74. <a-form-item field="section" label="嵌入模型" :rules="[{match:/section one/,message:'请选择'}]">
  75. <a-select v-model="form.section" placeholder="请选择" allow-clear>
  76. <a-option value="section one">Section One</a-option>
  77. <a-option value="section two">Section Two</a-option>
  78. <a-option value="section three">Section Three</a-option>
  79. </a-select>
  80. </a-form-item>
  81. <a-form-item field="section" label="解析方法" :rules="[{match:/section one/,message:'请选择'}]">
  82. <a-select v-model="form.section" placeholder="请选择" allow-clear>
  83. <a-option value="section one">Section One</a-option>
  84. <a-option value="section two">Section Two</a-option>
  85. <a-option value="section three">Section Three</a-option>
  86. </a-select>
  87. </a-form-item>
  88. <a-form-item field="slider" label="块Token数"
  89. :rules="[{type:'number', min:5,message:'slider is min than 5'}]">
  90. <a-slider v-model="form.score" :max="10" />
  91. <a-input-number v-model="form.score" :style="{width:'100px',marginLeft:'2rem',borderRadius:'4px'}"
  92. placeholder="Please Enter" class="input-demo" :min="10" :max="1000" />
  93. </a-form-item>
  94. <a-form-item field="slider" label="布局识别" :rules="[{type:'number', min:5,message:'slider is min than 5'}]">
  95. <a-space direction="vertical" size="large">
  96. <a-switch v-model="form.score" checked-value="yes" unchecked-value="no" />
  97. </a-space>
  98. </a-form-item>
  99. <a-form-item field="raptor" label="使用召回增强RAPTOR策略">
  100. <a-space direction="vertical" size="large">
  101. <a-switch v-model="form.raptor" @change="onChangeRAPTOR" />
  102. </a-space>
  103. </a-form-item>
  104. <div v-if="form.raptor">
  105. <a-form-item field="section" label="提示词">
  106. <a-textarea style="height: 10rem;border: 1px solid var(--color-fill-3);border-radius: 4px" placeholder=""
  107. allow-clear />
  108. </a-form-item>
  109. <a-form-item field="slider" label="最大token数"
  110. :rules="[{type:'number', min:5,message:'slider is min than 5'}]">
  111. <a-slider v-model="form.score" :max="10" />
  112. <a-input-number v-model="form.score" :style="{width:'100px',marginLeft:'2rem',borderRadius:'4px'}"
  113. placeholder="Please Enter" class="input-demo" :min="10" :max="1000" />
  114. </a-form-item>
  115. <a-form-item field="slider" label="阈值" :rules="[{type:'number', min:5,message:'slider is min than 5'}]">
  116. <a-slider v-model="form.score" :max="10" />
  117. <a-input-number v-model="form.score" :style="{width:'100px',marginLeft:'2rem',borderRadius:'4px'}"
  118. placeholder="Please Enter" class="input-demo" :min="10" :max="1000" />
  119. </a-form-item>
  120. <a-form-item field="slider" label="最大聚类数"
  121. :rules="[{type:'number', min:5,message:'slider is min than 5'}]">
  122. <a-slider v-model="form.score" :max="10" />
  123. <a-input-number v-model="form.score" :style="{width:'100px',marginLeft:'2rem',borderRadius:'4px'}"
  124. placeholder="Please Enter" class="input-demo" :min="10" :max="1000" />
  125. </a-form-item>
  126. <a-form-item field="slider" label="随机种子"
  127. :rules="[{type:'number', min:5,message:'slider is min than 5'}]">
  128. <a-input-number v-model="form.score" :style="{width:'300px',marginRight:'1rem',borderRadius:'4px'}"
  129. placeholder="请输入" class="input-demo" :min="10" :max="100" />
  130. <a-button type="primary" @click="">
  131. <icon-plus />
  132. </a-button>
  133. </a-form-item>
  134. </div>
  135. <a-form-item>
  136. <div style="width: 100%;text-align: right">
  137. <a-space>
  138. <a-button type="primary" html-type="submit">保存</a-button>
  139. <!-- <a-button @click="$refs.formRef.resetFields()">Reset</a-button>-->
  140. </a-space>
  141. </div>
  142. </a-form-item>
  143. </a-form>
  144. </div>
  145. </div>
  146. <div class="main-container-rt">
  147. <section data-inspector-line="34" data-inspector-column="4"
  148. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx"
  149. class="categoryPanelWrapper___yI4rY" ><h4
  150. class="ant-typography topTitle___tNiB9 css-dev-only-do-not-override-1wxecgq" data-inspector-line="37"
  151. data-inspector-column="10"
  152. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx">"General"
  153. 分块方法说明</h4>
  154. <p data-inspector-line="40" data-inspector-column="10"
  155. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx"><p>
  156. 支持的文件格式为<b>DOCX、EXCEL、PPT、IMAGE、PDF、TXT</b>。</p>
  157. <p>此方法将简单的方法应用于块文件:</p>
  158. <p>
  159. </p>
  160. <li>系统将使用视觉检测模型将连续文本分割成多个片段。</li>
  161. <li>接下来,这些连续的片段被合并成Token数不超过“Token数”的块。</li>
  162. <p></p></p>
  163. <h4 class="ant-typography css-dev-only-do-not-override-1wxecgq" data-inspector-line="45"
  164. data-inspector-column="10"
  165. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx">
  166. "General" 示例</h4><span class="ant-typography css-dev-only-do-not-override-1wxecgq" data-inspector-line="48"
  167. data-inspector-column="10"
  168. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx">提出以下屏幕截图以促进理解。</span>
  169. <div data-inspector-line="49" data-inspector-column="10"
  170. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx"
  171. class="ant-row imageRow___C3Xpb css-dev-only-do-not-override-1wxecgq"
  172. style="margin-left: -5px; margin-right: -5px; row-gap: 10px;display: flex; margin-top: 20px;width: 100%">
  173. <img
  174. data-inspector-line="32" data-inspector-column="8"
  175. data-inspector-relative-path="src\components\svg-icon.tsx" src="../../../assets/images/step1.png" alt=""
  176. width="50%">
  177. <img
  178. data-inspector-line="32" data-inspector-column="8"
  179. data-inspector-relative-path="src\components\svg-icon.tsx" src="../../../assets/images/step2.png" alt=""
  180. width="50%">
  181. </div>
  182. <h4 class="ant-typography css-dev-only-do-not-override-1wxecgq" data-inspector-line="60"
  183. data-inspector-column="10"
  184. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx">
  185. General 对话示例</h4>
  186. <div class="ant-divider css-dev-only-do-not-override-1wxecgq ant-divider-horizontal" data-inspector-line="63"
  187. data-inspector-column="10"
  188. data-inspector-relative-path="src\pages\add-knowledge\components\knowledge-setting\category-panel.tsx"
  189. role="separator"></div>
  190. <a-divider style="margin-top: 20px" />
  191. </section>
  192. </div>
  193. </div>
  194. </template>
  195. <script lang="ts" setup>
  196. import { onMounted, onBeforeMount, reactive, ref } from "vue";
  197. import { Message } from "@arco-design/web-vue";
  198. const props = defineProps({
  199. record: {
  200. type: Object,
  201. default: () => {
  202. return {};
  203. }
  204. }
  205. });
  206. const visible = ref(false);
  207. const configIsShow = ref(false);
  208. const loading = ref(false);
  209. const formRef = ref(null);
  210. const form = reactive({
  211. size: "medium",
  212. name: "",
  213. age: undefined,
  214. section: "0",
  215. province: "haidian",
  216. options: [],
  217. date: "",
  218. time: "",
  219. radio: "radio one",
  220. slider: 5,
  221. score: 5,
  222. switch: false,
  223. multiSelect: ["section one"],
  224. treeSelect: "",
  225. raptor: false
  226. });
  227. const options = [
  228. {
  229. value: "beijing",
  230. label: "Beijing",
  231. children: [
  232. {
  233. value: "chaoyang",
  234. label: "ChaoYang",
  235. children: [
  236. {
  237. value: "datunli",
  238. label: "Datunli"
  239. }
  240. ]
  241. },
  242. {
  243. value: "haidian",
  244. label: "Haidian"
  245. },
  246. {
  247. value: "dongcheng",
  248. label: "Dongcheng"
  249. },
  250. {
  251. value: "xicheng",
  252. label: "XiCheng"
  253. }
  254. ]
  255. },
  256. {
  257. value: "shanghai",
  258. label: "Shanghai",
  259. children: [
  260. {
  261. value: "shanghaishi",
  262. label: "Shanghai",
  263. children: [
  264. {
  265. value: "huangpu",
  266. label: "Huangpu"
  267. }
  268. ]
  269. }
  270. ]
  271. }
  272. ];
  273. const sayHello = () => {
  274. Message.info("hello");
  275. };
  276. const file = ref();
  277. const onChange = (_, currentFile) => {
  278. file.value = {
  279. ...currentFile
  280. // url: URL.createObjectURL(currentFile.file),
  281. };
  282. };
  283. const onProgress = (currentFile) => {
  284. file.value = currentFile;
  285. };
  286. const handleSubmit = ({ values, errors }) => {
  287. console.log("values:", values, "\nerrors:", errors);
  288. };
  289. const onChangeRAPTOR = () => {
  290. console.log(form.raptor);
  291. };
  292. const handleClick = () => {
  293. visible.value = true;
  294. };
  295. const handleBeforeOk = (done) => {
  296. formRef.value.validate().then(res => {
  297. console.log("form:", form);
  298. if (!form.name) {
  299. done(false);
  300. } else {
  301. console.log("请求数据");
  302. }
  303. });
  304. };
  305. const handleCancel = () => {
  306. visible.value = false;
  307. };
  308. const handleOpened = (el) => {
  309. Object.assign(form, {
  310. name: "",// 用户名
  311. nameJoin: "",// 昵称
  312. post: "",// 岗位
  313. txt: ""// 备注
  314. });
  315. formRef.value.resetFields();
  316. console.log(props.record, "record");
  317. // if(props.edit == 'edit'){
  318. // Object.assign(form,props.record);
  319. // }
  320. };
  321. onBeforeMount(() => {
  322. });
  323. onMounted(() => {
  324. });
  325. </script>
  326. <script lang="ts">
  327. import { IconEdit, IconPlus } from "@arco-design/web-vue/es/icon";
  328. export default {
  329. name: "config",
  330. components: { IconPlus, IconEdit },
  331. methods: {}
  332. };
  333. </script>
  334. <style scoped lang="less">
  335. .main-container {
  336. position: relative;
  337. display: flex;
  338. justify-content: space-between;
  339. height: 100%;
  340. overflow: auto;
  341. //background: #626aea;
  342. background: #ffffff;
  343. padding-top: 80px;
  344. &-lf {
  345. width: 40%;
  346. //height: 100%;
  347. //border: 1px solid #cccccc;
  348. border-radius: 10px;
  349. &-top {
  350. width: 100%;
  351. height: 60px;
  352. line-height: 60px;
  353. //background: rgb(var(--primary-6));
  354. //color: #ffffff;
  355. //text-align: center;
  356. }
  357. &-down {
  358. padding: 20px;
  359. width: 100%;
  360. }
  361. }
  362. &-form-item-extra {
  363. width: 100%;
  364. height: 20rem;
  365. border: 1px solid var(--color-fill-3);
  366. border-radius: 6px;
  367. overflow: hidden;
  368. &-top {
  369. width: 100%;
  370. height: 40px;
  371. line-height: 40px;
  372. border-bottom: 1px solid var(--color-fill-3);
  373. //background: rgb(var(--primary-6));
  374. color: #999999;
  375. text-align: center;
  376. }
  377. &-down {
  378. width: 92%;
  379. margin-left: 4%;
  380. margin-top: 30px;
  381. }
  382. &-btn {
  383. width: 96%;
  384. text-align: right;
  385. margin-top: 1rem;
  386. }
  387. }
  388. &-rt {
  389. width: 60%;
  390. //background: #626aea;
  391. //border: 1px solid #cccccc;
  392. border-radius: 10px;
  393. overflow: hidden;
  394. padding: 20px;
  395. section{
  396. width: 100%;
  397. color: #333333;
  398. }
  399. }
  400. }
  401. </style>