核工业西南物理研究院知识库AI客户端
xiangpei
2025-03-25 7692e06e56a2d56bb57733ba303b2a23b36975a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<template>
  <div style="display: flex;justify-content: center">
    <div class="knowledge-body">
      <el-select v-model="value" size="medium" placeholder="请选择知识库">
        <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
        </el-option>
      </el-select>
      <div class="normal-text" style="margin-top: 15px;margin-bottom: 5px">选择知识文件(单个文件不超过200M)</div>
      <el-alert
          description="HTML,MD,JSON,CSV,PDF,PNG,JPG,JPEG,BMP,EML,MSG,RST,RIF,TXT,XML,DOCX,EPUB,ODT,PPT,PPTX,TSV,HTM"
          type="info"
          :closable="false"
          show-icon>
      </el-alert>
      <el-upload
          class="upload"
          drag
          :on-change="handleChange"
          :before-upload="handleUpload"
          :file-list="fileList"
          multiple>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          <div>将文件拖到此处,或<em>点击上传</em></div>
        </div>
      </el-upload>
      <div class="file-setting">
        <div class="file-setting-content">
          <div class="normal-text file-setting-title">文件处理配置</div>
          <el-form :inline="true" :model="form" size="mini" label-position="top" class="form-inline">
            <el-form-item label="单段文本最大长度:">
              <el-input v-model="form.user" type="number"></el-input>
            </el-form-item>
            <el-form-item label="相邻文本重合长度:">
              <el-input v-model="form.user" type="number"></el-input>
            </el-form-item>
            <el-form-item label="其它:">
              <el-checkbox v-model="form.checked">开启中文标题加强</el-checkbox>
            </el-form-item>
          </el-form>
        </div>
      </div>
      <div style="margin-top: 15px">
        <el-button type="primary" size="small">添加文件到知识库</el-button>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "KnowledgeBase",
  data() {
    return {
      fileList: [],
      form: {
 
      },
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value: ''
    }
  },
  methods: {
    handleUpload(file) {
      if (this.fileList.indexOf(file) === -1) {
        this.fileList.push(file)
      }
      return false
    },
    handleChange(file, fileList) {
      this.fileList = fileList;
    }
  }
}
</script>
 
<style scoped>
.knowledge-body {
  width: 650px;
  margin-top: 70px;
}
.upload {
  margin-top: 5px;
}
.normal-text {
  color: #606266;
  font-size: 14px;
}
.file-setting {
  width: 100%;
  height: 100px;
  border: 1px solid lightgray;
  border-radius: 6px;
  position: relative;
}
.file-setting-title {
  margin-bottom: 10px;
}
.file-setting-content {
  width: 100%;
  height: 100%;
  padding: 8px;
}
.form-inline {
  padding-left: 10px;
}
.el-select {
  width: 100%;
}
.el-upload__tip {
  word-wrap: break-word;  /* 长单词或URL换行 */
  overflow-wrap: break-word; /* 更现代的属性,效果类似 */
  white-space: normal; /* 默认值,允许换行 */
}
::v-deep .el-upload-dragger {
  width: 650px !important;
}
 
::v-deep .el-upload-list {
  max-height: 100px;
  overflow-y: scroll;
}
::v-deep .el-form-item__label {
  padding-bottom: 0px;
}
 
::v-deep .el-form-item {
  margin-right: 20px;
}
</style>