@@ -103,7 +138,6 @@
:min="1"
:max="10"
controls-position="right"
- style="width: 145px"
/>
@@ -161,7 +195,8 @@ const title = ref('')
const inputValue = ref('')
const formInline = ref({
similarity: 0.6,
- top_number: 5
+ top_number: 5,
+ search_mode: 'embedding'
})
// 第一次加载
@@ -213,8 +248,7 @@ function sendChatHandle(event: any) {
function getHitTestList() {
const obj = {
query_text: inputValue.value,
- similarity: formInline.value.similarity,
- top_number: formInline.value.top_number
+ ...formInline.value
}
if (isDataset.value) {
datasetApi.getDatasetHitTest(id, obj, loading).then((res) => {
diff --git a/ui/src/views/log/component/EditContentDialog.vue b/ui/src/views/log/component/EditContentDialog.vue
index 86ad4f95e..a36b4a7eb 100644
--- a/ui/src/views/log/component/EditContentDialog.vue
+++ b/ui/src/views/log/component/EditContentDialog.vue
@@ -26,17 +26,18 @@
-
-
+
-
+
- {{ data.name }}
+ {{ item.name }}
-
-
+
+
+
+
+
+
+ {{ item.name }}
+
+
@@ -70,7 +88,6 @@ import { ref, watch, reactive } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import logApi from '@/api/log'
-import type { CascaderProps } from 'element-plus'
import useStore from '@/stores'
const { application, document } = useStore()
@@ -99,15 +116,19 @@ const form = ref({
problem_text: '',
title: '',
content: '',
- document: []
+ dataset_id: '',
+ document_id: ''
})
const rules = reactive({
content: [{ required: true, message: '请输入内容', trigger: 'blur' }],
- document: [{ type: 'array', required: true, message: '请选择文档', trigger: 'change' }]
+ dataset_id: [{ required: true, message: '请选择知识库', trigger: 'change' }],
+ document_id: [{ required: true, message: '请选择文档', trigger: 'change' }]
})
-const datasetList = ref([])
+const datasetList = ref([])
+const documentList = ref([])
+const optionLoading = ref(false)
watch(dialogVisible, (bool) => {
if (!bool) {
@@ -117,45 +138,40 @@ watch(dialogVisible, (bool) => {
problem_text: '',
title: '',
content: '',
- document: []
+ dataset_id: '',
+ document_id: ''
}
+ datasetList.value = []
+ documentList.value = []
+ formRef.value?.clearValidate()
}
})
-const LoadDocument: CascaderProps = {
- lazy: true,
- value: 'id',
- label: 'name',
- leaf: 'dataset_id',
- lazyLoad(node, resolve: any) {
- const { level, data } = node
- if (data?.id) {
- getDocument(data?.id as string, resolve)
- } else {
- getDataset(resolve)
- }
- }
+
+function changeDataset(id: string) {
+ form.value.document_id = ''
+ getDocument(id)
}
-function getDocument(id: string, resolve: any) {
+function getDocument(id: string) {
document.asyncGetAllDocument(id, loading).then((res: any) => {
- datasetList.value = res.data
- resolve(datasetList.value)
+ documentList.value = res.data
})
}
-function getDataset(resolve: any) {
+function getDataset() {
application.asyncGetApplicationDataset(id, loading).then((res: any) => {
datasetList.value = res.data
- resolve(datasetList.value)
})
}
const open = (data: any) => {
+ getDataset()
form.value.chat_id = data.chat_id
form.value.record_id = data.id
form.value.problem_text = data.problem_text
form.value.content = data.answer_text
+ formRef.value?.clearValidate()
dialogVisible.value = true
}
const submitForm = async (formEl: FormInstance | undefined) => {
@@ -171,8 +187,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
id,
form.value.chat_id,
form.value.record_id,
- form.value.document[0],
- form.value.document[1],
+ form.value.dataset_id,
+ form.value.document_id,
obj,
loading
)
diff --git a/ui/src/views/paragraph/component/ParagraphForm.vue b/ui/src/views/paragraph/component/ParagraphForm.vue
index 03f4396e7..b3d0becfb 100644
--- a/ui/src/views/paragraph/component/ParagraphForm.vue
+++ b/ui/src/views/paragraph/component/ParagraphForm.vue
@@ -30,6 +30,7 @@
:preview="false"
:toolbars="toolbars"
style="height: 300px"
+ @onUploadImg="onUploadImg"
/>
{
-// appendTarget()
-// }
-// const appendTarget = () => {
-// nextTick(() => {
-// var item = document.getElementsByClassName('maxkb-md')
-// for (var j = 0; j < item.length; j++) {
-// var aTags = item[j].getElementsByTagName('a')
-// for (var i = 0; i < aTags.length; i++) {
-// aTags[i].setAttribute('target', '_blank')
-// }
-// }
-// })
-// }
+const onUploadImg = async (files: any, callback: any) => {
+ const res = await Promise.all(
+ files.map((file: any) => {
+ return new Promise((rev, rej) => {
+ const fd = new FormData()
+ fd.append('file', file)
+
+ imageApi
+ .postImage(fd)
+ .then((res: any) => {
+ rev(res)
+ })
+ .catch((error) => rej(error))
+ })
+ })
+ )
+
+ callback(res.map((item) => item.data))
+}
onUnmounted(() => {
form.value = {
diff --git a/ui/src/views/problem/index.vue b/ui/src/views/problem/index.vue
index 13d643974..a944939fc 100644
--- a/ui/src/views/problem/index.vue
+++ b/ui/src/views/problem/index.vue
@@ -42,7 +42,7 @@
{})
}
-function editName(val: string) {
+function editName(val: string, problemId: string) {
if (val) {
const obj = {
content: val
}
- problemApi.putProblems(id, currentMouseId.value, obj, loading).then(() => {
+ problemApi.putProblems(id, problemId, obj, loading).then(() => {
getList()
MsgSuccess('修改成功')
})
diff --git a/ui/src/views/template/component/CreateModelDialog.vue b/ui/src/views/template/component/CreateModelDialog.vue
index 880291ddf..3741c0d48 100644
--- a/ui/src/views/template/component/CreateModelDialog.vue
+++ b/ui/src/views/template/component/CreateModelDialog.vue
@@ -30,9 +30,23 @@
label-position="top"
require-asterisk-position="right"
class="mb-24"
+ label-width="auto"
>
-
+
+
+
+
+ 模型名称
+
+
+
+ MaxKB 中自定义的模型名称
+
+
+
+
+
-
+
+
+ 模型类型
+
+ >
+
-
+
+
+
+
+ 基础模型
+
+
+
+ 为供应商的 LLM 模型,支持自定义输入
+
+ 下拉选项是 OpenAI
+ 常用的一些大语言模型如:gpt-3.5-turbo-0613、gpt-3.5-turbo、gpt-4 等
+
+
+
+
+
+
+ >
+
@@ -94,6 +128,8 @@ import type { FormField } from '@/components/dynamics-form/type'
import DynamicsForm from '@/components/dynamics-form/index.vue'
import type { FormRules } from 'element-plus'
import { MsgSuccess } from '@/utils/message'
+import { QuestionFilled } from '@element-plus/icons-vue'
+
const providerValue = ref()
const dynamicsFormRef = ref>()
const emit = defineEmits(['change', 'submit'])
@@ -204,10 +240,12 @@ defineExpose({ open, close })
font-weight: 400;
line-height: 24px;
cursor: pointer;
+
&:hover {
color: var(--el-color-primary);
}
}
+
.active-breadcrumb {
font-size: 16px;
color: rgba(31, 35, 41, 1);
diff --git a/ui/src/views/template/component/EditModel.vue b/ui/src/views/template/component/EditModel.vue
index 9602838f0..07b81508d 100644
--- a/ui/src/views/template/component/EditModel.vue
+++ b/ui/src/views/template/component/EditModel.vue
@@ -27,7 +27,20 @@
require-asterisk-position="right"
>
-
+
+
+
+
+ 模型名称
+
+
+
+ MaxKB 中自定义的模型名称
+
+
+
+
+
-
+
+
+ 模型类型
+
+ >
+
-
+
+
+
+
+ 基础模型
+
+
+
+ 为供应商的 LLM 模型,支持自定义输入
+
+ 下拉选项是 OpenAI
+ 常用的一些大语言模型如:gpt-3.5-turbo-0613、gpt-3.5-turbo、gpt-4 等
+
+
+
+
+
+
+ >
+
@@ -89,6 +122,8 @@ import type { FormField } from '@/components/dynamics-form/type'
import DynamicsForm from '@/components/dynamics-form/index.vue'
import type { FormRules } from 'element-plus'
import { MsgSuccess } from '@/utils/message'
+import { QuestionFilled } from '@element-plus/icons-vue'
+import AppIcon from '@/components/icons/AppIcon.vue'
const providerValue = ref()
const dynamicsFormRef = ref>()
@@ -153,7 +188,7 @@ const list_base_model = (model_type: any) => {
}
}
const open = (provider: Provider, model: Model) => {
- modelValue.value=model
+ modelValue.value = model
ModelApi.getModelById(model.id, formLoading).then((ok) => {
modelValue.value = ok.data
ModelApi.listModelType(model.provider, model_type_loading).then((ok) => {
@@ -208,10 +243,12 @@ defineExpose({ open, close })
font-weight: 400;
line-height: 24px;
cursor: pointer;
+
&:hover {
color: var(--el-color-primary);
}
}
+
.active-breadcrumb {
font-size: 16px;
color: rgba(31, 35, 41, 1);