mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:02:46 +00:00
fix: bug
This commit is contained in:
parent
ac6716b29b
commit
75410459eb
|
|
@ -127,7 +127,7 @@ const putChatRecordLog: (
|
|||
loading,
|
||||
) => {
|
||||
return put(
|
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/dataset/${knowledge_id}/document/${document_id}/improve`,
|
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
|
|
@ -137,7 +137,7 @@ const putChatRecordLog: (
|
|||
/**
|
||||
* 删除标注
|
||||
* @param 参数
|
||||
* application_id, chart_id, chart_record_id, dataset_id, document_id,paragraph_id
|
||||
* application_id, chart_id, chart_record_id, knowledge_id, document_id,paragraph_id
|
||||
*/
|
||||
const delMarkChatRecord: (
|
||||
application_id: String,
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ const putMigrateMulParagraph: (
|
|||
loading,
|
||||
) => {
|
||||
return put(
|
||||
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/migrate/dataset/${target_knowledge_id}/document/${target_document_id}`,
|
||||
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/migrate/knowledge/${target_knowledge_id}/document/${target_document_id}`,
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
|
|
@ -234,19 +234,19 @@ const putMigrateMulParagraph: (
|
|||
|
||||
/**
|
||||
* 解除某段落关联问题
|
||||
* @param 参数 dataset_id, document_id,
|
||||
* @param 参数 knowledge_id, document_id,
|
||||
* @query data {
|
||||
* paragraph_id 段落id problem_id 问题id
|
||||
* }
|
||||
*/
|
||||
const putDisassociationProblem: (
|
||||
dataset_id: string,
|
||||
knowledge_id: string,
|
||||
document_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
||||
) => Promise<Result<boolean>> = (knowledge_id, document_id, data, loading) => {
|
||||
return put(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/unassociation`,
|
||||
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/unassociation`,
|
||||
{},
|
||||
data,
|
||||
loading,
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ const putMigrateMulParagraph: (
|
|||
loading,
|
||||
) => {
|
||||
return put(
|
||||
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/migrate/dataset/${target_knowledge_id}/document/${target_document_id}`,
|
||||
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/migrate/knowledge/${target_knowledge_id}/document/${target_document_id}`,
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
|
|
@ -234,19 +234,19 @@ const putMigrateMulParagraph: (
|
|||
|
||||
/**
|
||||
* 解除某段落关联问题
|
||||
* @param 参数 dataset_id, document_id,
|
||||
* @param 参数 knowledge_id, document_id,
|
||||
* @query data {
|
||||
* paragraph_id 段落id problem_id 问题id
|
||||
* }
|
||||
*/
|
||||
const putDisassociationProblem: (
|
||||
dataset_id: string,
|
||||
knowledge_id: string,
|
||||
document_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
||||
) => Promise<Result<boolean>> = (knowledge_id, document_id, data, loading) => {
|
||||
return put(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/unassociation`,
|
||||
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/unassociation`,
|
||||
{},
|
||||
data,
|
||||
loading,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post } from '@/request/index'
|
||||
import type { User } from '@/api/type/user'
|
||||
import type { User, ResetPasswordRequest } from '@/api/type/user'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
/**
|
||||
|
|
@ -29,12 +29,28 @@ const getProfile: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) =
|
|||
/**
|
||||
* 获取全部用户
|
||||
*/
|
||||
const getUserList: (loading?: Ref<boolean>) => Promise<Result<Record<string, any>[]>> = (loading) => {
|
||||
const getUserList: (loading?: Ref<boolean>) => Promise<Result<Record<string, any>[]>> = (
|
||||
loading,
|
||||
) => {
|
||||
return get('/user/list', undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
* @param request 重置密码请求参数
|
||||
* @param loading 接口加载器
|
||||
* @returns
|
||||
*/
|
||||
const resetPassword: (
|
||||
request: ResetPasswordRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (request, loading) => {
|
||||
return post('/user/re_password', request, undefined, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
getUserProfile,
|
||||
getProfile,
|
||||
getUserList
|
||||
getUserList,
|
||||
resetPassword,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<!-- 知识库检索 -->
|
||||
<template v-if="item.type == WorkflowType.SearchDataset">
|
||||
<template v-if="item.type == WorkflowType.SearchKnowledge">
|
||||
<div class="card-never border-r-4">
|
||||
<h5 class="p-8-12">
|
||||
{{ $t('chat.executionDetails.searchContent') }}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ watch(dialogVisible, (bool) => {
|
|||
const open = (data: any, id?: string) => {
|
||||
detail.value = cloneDeep(data)
|
||||
detail.value.paragraph_list = id
|
||||
? detail.value.paragraph_list.filter((v: any) => v.dataset_id === id)
|
||||
? detail.value.paragraph_list.filter((v: any) => v.knowledge_id === id)
|
||||
: detail.value.paragraph_list
|
||||
detail.value.paragraph_list = arraySort(detail.value.paragraph_list, 'similarity', true)
|
||||
dialogVisible.value = true
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
|
||||
</el-avatar>
|
||||
|
||||
<span class="ellipsis-1 break-all" :title="data?.dataset_name">
|
||||
{{ data?.dataset_name }}</span
|
||||
<span class="ellipsis-1 break-all" :title="data?.knowledge_name">
|
||||
{{ data?.knowledge_name }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
:parent_field="formField.field + '.' + index"
|
||||
></DynamicsForm>
|
||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||
<el-button text @click.stop="deleteDataset(item)" class="delete-button">
|
||||
<el-button text @click.stop="deleteKnowledge(item)" class="delete-button">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
|
@ -47,7 +47,7 @@ const props = defineProps<{
|
|||
const render_data = () => {
|
||||
return Promise.resolve(Result.success(props.formField.children as Array<FormField>))
|
||||
}
|
||||
const deleteDataset = (item: any) => {
|
||||
const deleteKnowledge = (item: any) => {
|
||||
_data.value = _data.value.filter((row) => row !== item)
|
||||
}
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ const handleNodeClick = (data: Tree) => {
|
|||
}
|
||||
|
||||
const handleSharedNodeClick = () => {
|
||||
treeRef.value?.setCurrentKey(null)
|
||||
treeRef.value?.setCurrentKey(undefined)
|
||||
emit('handleNodeClick', { id: 'share', name: t('views.system.share_knowledge') })
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ import type { FormInstance } from 'element-plus'
|
|||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId } // id为datasetID
|
||||
params: { id, documentId } // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const { model, prompt, user } = useStore()
|
||||
|
|
@ -134,8 +134,8 @@ watch(dialogVisible, (bool) => {
|
|||
}
|
||||
})
|
||||
|
||||
const open = (ids: string[], type: string, _datasetId?: string) => {
|
||||
knowledgeId.value = _datasetId
|
||||
const open = (ids: string[], type: string, _knowledgeId?: string) => {
|
||||
knowledgeId.value = _knowledgeId
|
||||
getModel()
|
||||
idList.value = ids
|
||||
apiType.value = type
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-infinite-scroll="loadDataset" :infinite-scroll-disabled="disabledScroll">
|
||||
<div v-infinite-scroll="loadData" :infinite-scroll-disabled="disabledScroll">
|
||||
<slot />
|
||||
</div>
|
||||
<div style="padding: 16px 10px">
|
||||
|
|
@ -62,7 +62,7 @@ const noMore = computed(
|
|||
)
|
||||
const disabledScroll = computed(() => props.size > 0 && (props.loading || noMore.value))
|
||||
|
||||
function loadDataset() {
|
||||
function loadData() {
|
||||
if (props.total > props.page_size) {
|
||||
current.value += 1
|
||||
emit('update:current_page', current.value)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export enum WorkflowType {
|
|||
Base = 'base-node',
|
||||
Start = 'start-node',
|
||||
AiChat = 'ai-chat-node',
|
||||
SearchDataset = 'search-dataset-node',
|
||||
SearchKnowledge = 'search-knowledge-node',
|
||||
Question = 'question-node',
|
||||
Condition = 'condition-node',
|
||||
Reply = 'reply-node',
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ export enum DeviceType {
|
|||
|
||||
export enum ValidType {
|
||||
Application = 'application',
|
||||
Dataset = 'dataset',
|
||||
Knowledge = 'knowledge',
|
||||
User = 'user'
|
||||
}
|
||||
|
||||
export enum ValidCount {
|
||||
Application = 5,
|
||||
Dataset = 50,
|
||||
Knowledge = 50,
|
||||
User = 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ export enum WorkflowType {
|
|||
Base = 'base-node',
|
||||
Start = 'start-node',
|
||||
AiChat = 'ai-chat-node',
|
||||
SearchDataset = 'search-dataset-node',
|
||||
SearchKnowledge = 'search-knowledge-node',
|
||||
Question = 'question-node',
|
||||
Condition = 'condition-node',
|
||||
Reply = 'reply-node',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
class="mr-8"
|
||||
:size="24"
|
||||
/>
|
||||
<KnowledgeIcon v-else-if="isDataset" :type="current?.type" />
|
||||
<KnowledgeIcon v-else-if="isKnowledge" :type="current?.type" />
|
||||
|
||||
<div class="ellipsis" :title="current?.name">{{ current?.name }}</div>
|
||||
</div>
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
:size="24"
|
||||
/>
|
||||
|
||||
<KnowledgeIcon v-if="isDataset" :type="item.type" />
|
||||
<KnowledgeIcon v-if="isKnowledge" :type="item.type" />
|
||||
|
||||
<span class="ellipsis" :title="item?.name"> {{ item?.name }}</span>
|
||||
</div>
|
||||
|
|
@ -82,10 +82,10 @@
|
|||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isDataset">
|
||||
<template v-else-if="isKnowledge">
|
||||
<div class="w-full text-left cursor" @click="openCreateDialog">
|
||||
<el-button link>
|
||||
<el-icon class="mr-4"><Plus /></el-icon> {{ $t('views.dataset.createDataset') }}
|
||||
<el-icon class="mr-4"><Plus /></el-icon> {{ $t('views.knowledge.createKnowledge') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -93,15 +93,11 @@
|
|||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<!-- <CreateApplicationDialog ref="CreateApplicationDialogRef" @refresh="refresh" />
|
||||
<CreateDatasetDialog ref="CreateDatasetDialogRef" @refresh="refresh" /> -->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router'
|
||||
// import CreateApplicationDialog from '@/views/application/component/CreateApplicationDialog.vue'
|
||||
// import CreateDatasetDialog from '@/views/dataset/component/CreateDatasetDialog.vue'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
|
||||
|
|
@ -118,7 +114,7 @@ onBeforeRouteLeave((to, from) => {
|
|||
common.saveBreadcrumb(null)
|
||||
})
|
||||
|
||||
const CreateDatasetDialogRef = ref()
|
||||
const CreateKnowledgeDialogRef = ref()
|
||||
const CreateApplicationDialogRef = ref()
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
|
|
@ -132,13 +128,13 @@ const current = computed(() => {
|
|||
const isApplication = computed(() => {
|
||||
return activeMenu.includes('application')
|
||||
})
|
||||
const isDataset = computed(() => {
|
||||
const isKnowledge = computed(() => {
|
||||
return activeMenu.includes('knowledge')
|
||||
})
|
||||
|
||||
function openCreateDialog() {
|
||||
if (isDataset.value) {
|
||||
CreateDatasetDialogRef.value.open()
|
||||
if (isKnowledge.value) {
|
||||
CreateKnowledgeDialogRef.value.open()
|
||||
} else if (isApplication.value) {
|
||||
CreateApplicationDialogRef.value.open()
|
||||
}
|
||||
|
|
@ -147,7 +143,7 @@ function openCreateDialog() {
|
|||
function changeMenu(id: string) {
|
||||
const lastMatched = route.matched[route.matched.length - 1]
|
||||
if (lastMatched) {
|
||||
if (isDataset.value) {
|
||||
if (isKnowledge.value) {
|
||||
router.push({ name: lastMatched.name, params: { id: id } })
|
||||
} else if (isApplication.value) {
|
||||
const type = list.value?.filter((v) => v.id === id)?.[0]?.type
|
||||
|
|
@ -166,7 +162,7 @@ function changeMenu(id: string) {
|
|||
}
|
||||
}
|
||||
|
||||
function getDataset() {
|
||||
function getKnowledge() {
|
||||
loading.value = true
|
||||
knowledge
|
||||
.asyncGetRootKnowledge()
|
||||
|
|
@ -197,8 +193,8 @@ function refresh() {
|
|||
}
|
||||
onMounted(() => {
|
||||
if (!breadcrumbData.value) {
|
||||
if (isDataset.value) {
|
||||
getDataset()
|
||||
if (isKnowledge.value) {
|
||||
getKnowledge()
|
||||
} else if (isApplication.value) {
|
||||
getApplication()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
</div>
|
||||
<div class="flex">
|
||||
<span class="label">{{ $t('layout.about.expiredTime') }}</span>
|
||||
<span
|
||||
<!-- <span
|
||||
>{{ licenseInfo?.expired || '-' }}
|
||||
<span class="color-danger" v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"
|
||||
>({{ fromNowDate(licenseInfo?.expired) }})</span
|
||||
></span
|
||||
>
|
||||
> -->
|
||||
</div>
|
||||
<div class="flex">
|
||||
<span class="label">{{ $t('layout.about.edition.label') }}</span>
|
||||
|
|
@ -65,8 +65,8 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import licenseApi from '@/api/license'
|
||||
import { fromNowDate } from '@/utils/time'
|
||||
// import licenseApi from '@/api/license'
|
||||
// import { fromNowDate } from '@/utils/time'
|
||||
import { Role } from '@/utils/permission/type'
|
||||
import useStore from '@/stores'
|
||||
const { user, theme } = useStore()
|
||||
|
|
@ -98,15 +98,15 @@ const open = () => {
|
|||
const onChange = (file: any) => {
|
||||
const fd = new FormData()
|
||||
fd.append('license_file', file.raw)
|
||||
licenseApi.putLicense(fd, loading).then((res: any) => {
|
||||
getLicenseInfo()
|
||||
isUpdate.value = true
|
||||
})
|
||||
// licenseApi.putLicense(fd, loading).then((res: any) => {
|
||||
// getLicenseInfo()
|
||||
// isUpdate.value = true
|
||||
// })
|
||||
}
|
||||
function getLicenseInfo() {
|
||||
licenseApi.getLicense(loading).then((res: any) => {
|
||||
licenseInfo.value = res.data?.license
|
||||
})
|
||||
// licenseApi.getLicense(loading).then((res: any) => {
|
||||
// licenseInfo.value = res.data?.license
|
||||
// })
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ export default {
|
|||
defaultPrompt: 'Known Information',
|
||||
think: 'Thinking Process'
|
||||
},
|
||||
searchDatasetNode: {
|
||||
searchKnowledgeNode: {
|
||||
label: 'Knowledge Retrieval',
|
||||
text: 'Allows you to query text content related to user questions from the Knowledge',
|
||||
paragraph_list: 'List of retrieved segments',
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export default {
|
|||
audioText: '需要使用“语音转文本”节点解析音频内容',
|
||||
otherText: '需要自行解析该类型文件'
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
aiChatNode: {
|
||||
|
|
@ -123,7 +123,7 @@ export default {
|
|||
defaultPrompt: '已知信息',
|
||||
think: '思考过程'
|
||||
},
|
||||
searchDatasetNode: {
|
||||
searchKnowledgeNode: {
|
||||
label: '知识库检索',
|
||||
text: '关联知识库,查找与问题相关的分段',
|
||||
paragraph_list: '检索结果的分段列表',
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ export default {
|
|||
defaultPrompt: '已知信息',
|
||||
think: '思考過程'
|
||||
},
|
||||
searchDatasetNode: {
|
||||
searchKnowledgeNode: {
|
||||
label: '知識庫檢索',
|
||||
text: '關聯知識庫,查找與問題相關的分段',
|
||||
paragraph_list: '檢索結果的分段列表',
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const DocumentRouter = {
|
|||
},
|
||||
{
|
||||
path: 'hit-test-shared',
|
||||
name: 'DatasetHitTestSharedSystem',
|
||||
name: 'KnowledgeHitTestSharedSystem',
|
||||
meta: {
|
||||
icon: 'app-hit-test',
|
||||
title: 'views.application.hitTest.title',
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const DocumentRouter = {
|
|||
},
|
||||
{
|
||||
path: 'hit-test',
|
||||
name: 'DatasetHitTest',
|
||||
name: 'KnowledgeHitTest',
|
||||
meta: {
|
||||
icon: 'app-hit-test',
|
||||
title: 'views.application.hitTest.title',
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ const useApplicationStore = defineStore('application', {
|
|||
actions: {
|
||||
async asyncGetAllApplication() {
|
||||
return new Promise((resolve, reject) => {
|
||||
applicationApi
|
||||
.getAllAppilcation()
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
// applicationApi
|
||||
// .getAllAppilcation()
|
||||
// .then((data) => {
|
||||
// resolve(data)
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error)
|
||||
// })
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -62,15 +62,15 @@ const useApplicationStore = defineStore('application', {
|
|||
|
||||
async asyncGetAppProfile(loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
applicationApi
|
||||
.getAppProfile(loading)
|
||||
.then((res) => {
|
||||
sessionStorage.setItem('language', res.data?.language || getBrowserLang())
|
||||
resolve(res)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
// applicationApi
|
||||
// .getAppProfile(loading)
|
||||
// .then((res) => {
|
||||
// sessionStorage.setItem('language', res.data?.language || getBrowserLang())
|
||||
// resolve(res)
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error)
|
||||
// })
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -110,14 +110,14 @@ const useApplicationStore = defineStore('application', {
|
|||
},
|
||||
async validatePassword(id: string, password: string, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
applicationApi
|
||||
.validatePassword(id, password, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
// applicationApi
|
||||
// .validatePassword(id, password, loading)
|
||||
// .then((data) => {
|
||||
// resolve(data)
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error)
|
||||
// })
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -38,38 +38,38 @@ const useChatLogStore = defineStore('chatLog',{
|
|||
},
|
||||
async asyncGetChatLogClient(id: string, page: pageRequest, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chatLogApi
|
||||
.getChatLogClient(id, page, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
// chatLogApi
|
||||
// .getChatLogClient(id, page, loading)
|
||||
// .then((data) => {
|
||||
// resolve(data)
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error)
|
||||
// })
|
||||
})
|
||||
},
|
||||
async asyncDelChatClientLog(id: string, chatId: string, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chatLogApi
|
||||
.delChatClientLog(id, chatId, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
// chatLogApi
|
||||
// .delChatClientLog(id, chatId, loading)
|
||||
// .then((data) => {
|
||||
// resolve(data)
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error)
|
||||
// })
|
||||
})
|
||||
},
|
||||
async asyncPutChatClientLog(id: string, chatId: string, data: any, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chatLogApi
|
||||
.putChatClientLog(id, chatId, data, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
// chatLogApi
|
||||
// .putChatClientLog(id, chatId, data, loading)
|
||||
// .then((data) => {
|
||||
// resolve(data)
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error)
|
||||
// })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,12 +261,12 @@ function onmousedown(item: any, data?: any, type?: string) {
|
|||
}
|
||||
|
||||
function getList() {
|
||||
applicationApi.listTool(props.id, loading).then((res: any) => {
|
||||
toolList.value = res.data
|
||||
})
|
||||
applicationApi.getApplicationList(props.id, loading).then((res: any) => {
|
||||
applicationList.value = res.data
|
||||
})
|
||||
// applicationApi.listTool(props.id, loading).then((res: any) => {
|
||||
// toolList.value = res.data
|
||||
// })
|
||||
// applicationApi.getApplicationList(props.id, loading).then((res: any) => {
|
||||
// applicationList.value = res.data
|
||||
// })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -111,20 +111,20 @@ function editName(val: string, item: any) {
|
|||
const obj = {
|
||||
name: val
|
||||
}
|
||||
applicationApi.putWorkFlowVersion(id as string, item.id, obj, loading).then(() => {
|
||||
MsgSuccess(t('common.modifySuccess'))
|
||||
item['writeStatus'] = false
|
||||
getList()
|
||||
})
|
||||
// applicationApi.putWorkFlowVersion(id as string, item.id, obj, loading).then(() => {
|
||||
// MsgSuccess(t('common.modifySuccess'))
|
||||
// item['writeStatus'] = false
|
||||
// getList()
|
||||
// })
|
||||
} else {
|
||||
MsgError(t('views.applicationWorkflow.tip.nameMessage'))
|
||||
}
|
||||
}
|
||||
|
||||
function getList() {
|
||||
applicationApi.getWorkFlowVersion(id, loading).then((res: any) => {
|
||||
LogData.value = res.data
|
||||
})
|
||||
// applicationApi.getWorkFlowVersion(id, loading).then((res: any) => {
|
||||
// LogData.value = res.data
|
||||
// })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -278,13 +278,13 @@ async function publicHandle() {
|
|||
MsgError(e.toString())
|
||||
return
|
||||
}
|
||||
applicationApi.putPublishApplication(id as string, obj, loading).then(() => {
|
||||
// applicationApi.putPublishApplication(id as string, obj, loading).then(() => {
|
||||
|
||||
application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
||||
detail.value.name = res.data.name
|
||||
MsgSuccess(t('views.applicationWorkflow.tip.publicSuccess'))
|
||||
})
|
||||
})
|
||||
// application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
||||
// detail.value.name = res.data.name
|
||||
// MsgSuccess(t('views.applicationWorkflow.tip.publicSuccess'))
|
||||
// })
|
||||
// })
|
||||
})
|
||||
.catch((res: any) => {
|
||||
const node = res.node
|
||||
|
|
|
|||
|
|
@ -111,13 +111,13 @@ function refresh() {
|
|||
|
||||
function getPlatformStatus() {
|
||||
loading.value = true
|
||||
applicationApi.getPlatformStatus(id).then((res: any) => {
|
||||
platforms.forEach((platform) => {
|
||||
platform.isActive = res.data[platform.key][1]
|
||||
platform.exists = res.data[platform.key][0]
|
||||
})
|
||||
loading.value = false
|
||||
})
|
||||
// applicationApi.getPlatformStatus(id).then((res: any) => {
|
||||
// platforms.forEach((platform) => {
|
||||
// platform.isActive = res.data[platform.key][1]
|
||||
// platform.exists = res.data[platform.key][0]
|
||||
// })
|
||||
// loading.value = false
|
||||
// })
|
||||
}
|
||||
|
||||
function changeStatus(type: string, value: boolean) {
|
||||
|
|
|
|||
|
|
@ -383,11 +383,11 @@ const open = async (id: string, type: PlatformType) => {
|
|||
dataLoaded.value = false
|
||||
formRef.value?.resetFields()
|
||||
try {
|
||||
const res = await applicationApi.getPlatformConfig(id, type)
|
||||
if (res.data) {
|
||||
form[configType.value] = res.data
|
||||
}
|
||||
dataLoaded.value = true
|
||||
// const res = await applicationApi.getPlatformConfig(id, type)
|
||||
// if (res.data) {
|
||||
// form[configType.value] = res.data
|
||||
// }
|
||||
// dataLoaded.value = true
|
||||
} catch {
|
||||
MsgError(t('views.application.tip.loadingErrorMessage'))
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ const { common, user } = useStore()
|
|||
// @ts-ignore
|
||||
const defaultPrompt = t('views.application.form.prompt.defaultPrompt', {
|
||||
data: '{data}',
|
||||
question: '{question}'
|
||||
question: '{question}',
|
||||
})
|
||||
const applicationFormRef = ref()
|
||||
|
||||
|
|
@ -76,22 +76,22 @@ const applicationForm = ref<ApplicationFormType>({
|
|||
model_id: '',
|
||||
dialogue_number: 0,
|
||||
prologue: t('views.application.form.defaultPrologue'),
|
||||
dataset_id_list: [],
|
||||
dataset_setting: {
|
||||
knowledge_id_list: [],
|
||||
knowledge_setting: {
|
||||
top_n: 3,
|
||||
similarity: 0.6,
|
||||
max_paragraph_char_number: 5000,
|
||||
search_mode: 'embedding',
|
||||
no_references_setting: {
|
||||
status: 'ai_questioning',
|
||||
value: '{question}'
|
||||
}
|
||||
value: '{question}',
|
||||
},
|
||||
},
|
||||
model_setting: {
|
||||
prompt: defaultPrompt
|
||||
prompt: defaultPrompt,
|
||||
},
|
||||
problem_optimization: false,
|
||||
type: 'SIMPLE'
|
||||
type: 'SIMPLE',
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules<ApplicationFormType>>({
|
||||
|
|
@ -99,9 +99,9 @@ const rules = reactive<FormRules<ApplicationFormType>>({
|
|||
{
|
||||
required: true,
|
||||
message: t('views.application.form.appName.placeholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
|
|
@ -112,22 +112,22 @@ watch(dialogVisible, (bool) => {
|
|||
model_id: '',
|
||||
dialogue_number: 0,
|
||||
prologue: t('views.application.form.defaultPrologue'),
|
||||
dataset_id_list: [],
|
||||
dataset_setting: {
|
||||
knowledge_id_list: [],
|
||||
knowledge_setting: {
|
||||
top_n: 3,
|
||||
similarity: 0.6,
|
||||
max_paragraph_char_number: 5000,
|
||||
search_mode: 'embedding',
|
||||
no_references_setting: {
|
||||
status: 'ai_questioning',
|
||||
value: '{question}'
|
||||
}
|
||||
value: '{question}',
|
||||
},
|
||||
},
|
||||
model_setting: {
|
||||
prompt: defaultPrompt
|
||||
prompt: defaultPrompt,
|
||||
},
|
||||
problem_optimization: false,
|
||||
type: 'SIMPLE'
|
||||
type: 'SIMPLE',
|
||||
}
|
||||
applicationFormRef.value?.clearValidate()
|
||||
}
|
||||
|
|
@ -145,15 +145,15 @@ const submitValid = (formEl: FormInstance | undefined) => {
|
|||
if (user.isEnterprise()) {
|
||||
submitHandle(formEl)
|
||||
} else {
|
||||
common
|
||||
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
submitHandle(formEl)
|
||||
} else {
|
||||
MsgAlert(t('common.tip'), t('views.application.tip.professionalMessage'))
|
||||
}
|
||||
})
|
||||
// common
|
||||
// .asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
// .then(async (res: any) => {
|
||||
// if (res?.data) {
|
||||
// submitHandle(formEl)
|
||||
// } else {
|
||||
// MsgAlert(t('common.tip'), t('views.application.tip.professionalMessage'))
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
const submitHandle = async (formEl: FormInstance | undefined) => {
|
||||
|
|
|
|||
|
|
@ -120,31 +120,31 @@ const testPlay = () => {
|
|||
...form_data.value,
|
||||
tts_model_id: tts_model_id.value
|
||||
}
|
||||
applicationApi
|
||||
.playDemoText(id as string, data, playLoading)
|
||||
.then(async (res: any) => {
|
||||
if (res.type === 'application/json') {
|
||||
const text = await res.text()
|
||||
MsgError(text)
|
||||
return
|
||||
}
|
||||
// 创建 Blob 对象
|
||||
const blob = new Blob([res], { type: 'audio/mp3' })
|
||||
// applicationApi
|
||||
// .playDemoText(id as string, data, playLoading)
|
||||
// .then(async (res: any) => {
|
||||
// if (res.type === 'application/json') {
|
||||
// const text = await res.text()
|
||||
// MsgError(text)
|
||||
// return
|
||||
// }
|
||||
// // 创建 Blob 对象
|
||||
// const blob = new Blob([res], { type: 'audio/mp3' })
|
||||
|
||||
// 创建对象 URL
|
||||
const url = URL.createObjectURL(blob)
|
||||
// // 创建对象 URL
|
||||
// const url = URL.createObjectURL(blob)
|
||||
|
||||
// 检查 audioPlayer 是否已经引用了 DOM 元素
|
||||
if (audioPlayer.value instanceof HTMLAudioElement) {
|
||||
audioPlayer.value.src = url
|
||||
audioPlayer.value.play() // 自动播放音频
|
||||
} else {
|
||||
console.error('audioPlayer.value is not an instance of HTMLAudioElement')
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err: ', err)
|
||||
})
|
||||
// // 检查 audioPlayer 是否已经引用了 DOM 元素
|
||||
// if (audioPlayer.value instanceof HTMLAudioElement) {
|
||||
// audioPlayer.value.src = url
|
||||
// audioPlayer.value.play() // 自动播放音频
|
||||
// } else {
|
||||
// console.error('audioPlayer.value is not an instance of HTMLAudioElement')
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.log('err: ', err)
|
||||
// })
|
||||
}
|
||||
|
||||
defineExpose({ open, reset_default })
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@
|
|||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('views.chatLog.selectKnowledge')" prop="dataset_id">
|
||||
<el-form-item :label="$t('views.chatLog.selectKnowledge')" prop="knowledge_id">
|
||||
<el-select
|
||||
v-model="form.dataset_id"
|
||||
v-model="form.knowledge_id"
|
||||
filterable
|
||||
:placeholder="$t('views.chatLog.selectKnowledgePlaceholder')"
|
||||
:loading="optionLoading"
|
||||
@change="changeDataset"
|
||||
@change="changeKnowledge"
|
||||
>
|
||||
<el-option v-for="item in datasetList" :key="item.id" :label="item.name" :value="item.id">
|
||||
<el-option v-for="item in knowledgeList" :key="item.id" :label="item.name" :value="item.id">
|
||||
<span class="flex align-center">
|
||||
<KnowledgeIcon v-if="item.dataset_id" :type="item.type" />
|
||||
<KnowledgeIcon v-if="item.knowledge_id" :type="item.type" />
|
||||
|
||||
{{ item.name }}
|
||||
</span>
|
||||
|
|
@ -153,19 +153,19 @@ const form = ref<any>({
|
|||
problem_text: '',
|
||||
title: '',
|
||||
content: '',
|
||||
dataset_id: '',
|
||||
knowledge_id: '',
|
||||
document_id: '',
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
content: [{ required: true, message: t('views.chatLog.form.content.placeholder'), trigger: 'blur' }],
|
||||
dataset_id: [
|
||||
knowledge_id: [
|
||||
{ required: true, message: t('views.chatLog.selectKnowledgePlaceholder'), trigger: 'change' },
|
||||
],
|
||||
document_id: [{ required: true, message: t('views.chatLog.documentPlaceholder'), trigger: 'change' }],
|
||||
})
|
||||
|
||||
const datasetList = ref<any[]>([])
|
||||
const knowledgeList = ref<any[]>([])
|
||||
const documentList = ref<any[]>([])
|
||||
const optionLoading = ref(false)
|
||||
|
||||
|
|
@ -177,10 +177,10 @@ watch(dialogVisible, (bool) => {
|
|||
problem_text: '',
|
||||
title: '',
|
||||
content: '',
|
||||
dataset_id: '',
|
||||
knowledge_id: '',
|
||||
document_id: '',
|
||||
}
|
||||
datasetList.value = []
|
||||
knowledgeList.value = []
|
||||
documentList.value = []
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
|
|
@ -206,18 +206,18 @@ const onUploadImg = async (files: any, callback: any) => {
|
|||
callback(res.map((item) => item.data))
|
||||
}
|
||||
|
||||
function changeDataset(dataset_id: string) {
|
||||
localStorage.setItem(id + 'chat_dataset_id', dataset_id)
|
||||
function changeKnowledge(knowledge_id: string) {
|
||||
localStorage.setItem(id + 'chat_knowledge_id', knowledge_id)
|
||||
form.value.document_id = ''
|
||||
getDocument(dataset_id)
|
||||
getDocument(knowledge_id)
|
||||
}
|
||||
|
||||
function changeDocument(document_id: string) {
|
||||
localStorage.setItem(id + 'chat_document_id', document_id)
|
||||
}
|
||||
|
||||
function getDocument(dataset_id: string) {
|
||||
document.asyncGetAllDocument(dataset_id, loading).then((res: any) => {
|
||||
function getDocument(knowledge_id: string) {
|
||||
document.asyncGetAllDocument(knowledge_id, loading).then((res: any) => {
|
||||
documentList.value = res.data
|
||||
if (localStorage.getItem(id + 'chat_document_id')) {
|
||||
form.value.document_id = localStorage.getItem(id + 'chat_document_id') as string
|
||||
|
|
@ -228,23 +228,23 @@ function getDocument(dataset_id: string) {
|
|||
})
|
||||
}
|
||||
|
||||
function getDataset() {
|
||||
application.asyncGetApplicationKnowledge(id, loading).then((res: any) => {
|
||||
datasetList.value = res.data
|
||||
if (localStorage.getItem(id + 'chat_dataset_id')) {
|
||||
form.value.dataset_id = localStorage.getItem(id + 'chat_dataset_id') as string
|
||||
if (!datasetList.value.find((v) => v.id === form.value.dataset_id)) {
|
||||
form.value.dataset_id = ''
|
||||
form.value.document_id = ''
|
||||
} else {
|
||||
getDocument(form.value.dataset_id)
|
||||
}
|
||||
}
|
||||
})
|
||||
function getKnowledge_id() {
|
||||
// application.asyncGetApplicationKnowledge(id, loading).then((res: any) => {
|
||||
// knowledgeList.value = res.data
|
||||
// if (localStorage.getItem(id + 'chat_knowledge_id')) {
|
||||
// form.value.knowledge_id = localStorage.getItem(id + 'chat_knowledge_id') as string
|
||||
// if (!knowledgeList.value.find((v) => v.id === form.value.knowledge_id)) {
|
||||
// form.value.knowledge_id = ''
|
||||
// form.value.document_id = ''
|
||||
// } else {
|
||||
// getDocument(form.value.knowledge_id)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
const open = (data: any) => {
|
||||
getDataset()
|
||||
getKnowledge_id()
|
||||
form.value.chat_id = data.chat_id
|
||||
form.value.record_id = data.id
|
||||
form.value.problem_text = data.problem_text ? data.problem_text.substring(0, 256) : ''
|
||||
|
|
@ -266,7 +266,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|||
id,
|
||||
form.value.chat_id,
|
||||
form.value.record_id,
|
||||
form.value.dataset_id,
|
||||
form.value.knowledge_id,
|
||||
form.value.document_id,
|
||||
obj,
|
||||
loading,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ function deleteMark() {
|
|||
id as string,
|
||||
detail.value.chat_id,
|
||||
detail.value.id,
|
||||
form.value.dataset,
|
||||
form.value.knowledge,
|
||||
form.value.document,
|
||||
form.value.id,
|
||||
loading,
|
||||
|
|
@ -123,7 +123,7 @@ function getMark(data: any) {
|
|||
id as string,
|
||||
data.chat_id,
|
||||
data.id,
|
||||
data.dataset,
|
||||
data.knowledge,
|
||||
data.document,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -145,7 +145,7 @@ const submit = async (formEl: FormInstance) => {
|
|||
if (valid) {
|
||||
paragraph
|
||||
.asyncPutParagraph(
|
||||
form.value.dataset,
|
||||
form.value.knowledge,
|
||||
form.value.document,
|
||||
form.value.id,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -564,18 +564,18 @@ function changeDocument(document_id: string) {
|
|||
const knowledgeList = ref<any[]>([])
|
||||
|
||||
function getKnowledge() {
|
||||
application.asyncGetApplicationKnowledge(id, documentLoading).then((res: any) => {
|
||||
knowledgeList.value = res.data
|
||||
if (localStorage.getItem(id + 'chat_knowledge_id')) {
|
||||
form.value.knowledge_id = localStorage.getItem(id + 'chat_knowledge_id') as string
|
||||
if (!knowledgeList.value.find((v) => v.id === form.value.knowledge_id)) {
|
||||
form.value.knowledge_id = ''
|
||||
form.value.document_id = ''
|
||||
} else {
|
||||
getDocument(form.value.knowledge_id)
|
||||
}
|
||||
}
|
||||
})
|
||||
// application.asyncGetApplicationKnowledge(id, documentLoading).then((res: any) => {
|
||||
// knowledgeList.value = res.data
|
||||
// if (localStorage.getItem(id + 'chat_knowledge_id')) {
|
||||
// form.value.knowledge_id = localStorage.getItem(id + 'chat_knowledge_id') as string
|
||||
// if (!knowledgeList.value.find((v) => v.id === form.value.knowledge_id)) {
|
||||
// form.value.knowledge_id = ''
|
||||
// form.value.document_id = ''
|
||||
// } else {
|
||||
// getDocument(form.value.knowledge_id)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import type { FormInstance } from 'element-plus'
|
|||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const { log } = useStore()
|
||||
const { chatLog } = useStore()
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const fieldFormRef = ref()
|
||||
|
|
@ -74,7 +74,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (!formEl) return
|
||||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
log.asyncPutChatClientLog(applicationId.value, chatId.value, form.value, loading).then(() => {
|
||||
chatLog.asyncPutChatClientLog(applicationId.value, chatId.value, form.value, loading).then(() => {
|
||||
emit('refresh', chatId.value, form.value.abstract)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ const activeKey = ref('')
|
|||
const allConfigs = ref<PlatformConfig[]>([])
|
||||
const config = ref<Config>({ app_key: '', app_secret: '' })
|
||||
// const logoUrl = ref('')
|
||||
const { user } = useStore()
|
||||
const { login } = useStore()
|
||||
async function getPlatformInfo() {
|
||||
try {
|
||||
return await user.getQrSource()
|
||||
return await login.getQrSource()
|
||||
} catch (error) {
|
||||
return []
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const props = defineProps<{
|
|||
}>()
|
||||
|
||||
const router = useRouter()
|
||||
const { user } = useStore()
|
||||
const { login } = useStore()
|
||||
const { load } = useScriptTag('https://g.alicdn.com/dingding/h5-dingtalk-login/0.21.0/ddlogin.js')
|
||||
const isConfigReady = ref(false)
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ const initActive = async () => {
|
|||
},
|
||||
(loginResult) => {
|
||||
const authCode = loginResult.authCode
|
||||
user.dingCallback(authCode).then(() => {
|
||||
login.dingCallback(authCode).then(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const router = useRouter()
|
|||
|
||||
const wwLogin = ref({})
|
||||
const obj = ref<any>({ isWeComLogin: false })
|
||||
const { user } = useStore()
|
||||
const { login } = useStore()
|
||||
|
||||
const props = defineProps<{
|
||||
config: {
|
||||
|
|
@ -53,7 +53,7 @@ const init = async () => {
|
|||
},
|
||||
onCheckWeComLogin: obj.value,
|
||||
async onLoginSuccess({ code }: any) {
|
||||
user.wecomCallback(code).then(() => {
|
||||
login.wecomCallback(code).then(() => {
|
||||
setTimeout(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="flex-between">
|
||||
<div>
|
||||
<el-button
|
||||
v-if="datasetDetail.type === 0"
|
||||
v-if="knowledgeDetail.type === 0"
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
"
|
||||
>{{ $t('views.document.uploadDocument') }}
|
||||
</el-button>
|
||||
<el-button v-if="datasetDetail.type === 1" type="primary" @click="importDoc"
|
||||
<el-button v-if="knowledgeDetail.type === 1" type="primary" @click="importDoc"
|
||||
>{{ $t('views.document.importDocument') }}
|
||||
</el-button>
|
||||
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
<el-button @click="openGenerateDialog()" :disabled="multipleSelection.length === 0">
|
||||
{{ $t('views.document.generateQuestion.title') }}
|
||||
</el-button>
|
||||
<el-button @click="openDatasetDialog()" :disabled="multipleSelection.length === 0">
|
||||
<el-button @click="openknowledgeDialog()" :disabled="multipleSelection.length === 0">
|
||||
{{ $t('views.document.setting.migration') }}
|
||||
</el-button>
|
||||
<el-dropdown>
|
||||
|
|
@ -46,17 +46,17 @@
|
|||
divided
|
||||
@click="syncMulDocument"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
v-if="datasetDetail.type === 1"
|
||||
v-if="knowledgeDetail.type === 1"
|
||||
>{{ $t('views.document.syncDocument') }}</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
divided
|
||||
v-if="datasetDetail.type === 2"
|
||||
v-if="knowledgeDetail.type === 2"
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: '/knowledge/import',
|
||||
query: { id: id, folder_token: datasetDetail.meta.folder_token },
|
||||
query: { id: id, folder_token: knowledgeDetail.meta.folder_token },
|
||||
})
|
||||
"
|
||||
>{{ $t('views.document.importDocument') }}</el-dropdown-item
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
divided
|
||||
@click="syncLarkMulDocument"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
v-if="datasetDetail.type === 2"
|
||||
v-if="knowledgeDetail.type === 2"
|
||||
>{{ $t('views.document.syncDocument') }}</el-dropdown-item
|
||||
>
|
||||
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
class="mt-16"
|
||||
:data="documentData"
|
||||
:pagination-config="paginationConfig"
|
||||
:quick-create="datasetDetail.type === 0"
|
||||
:quick-create="knowledgeDetail.type === 0"
|
||||
@sizeChange="handleSizeChange"
|
||||
@changePage="getList"
|
||||
@cell-mouse-enter="cellMouseEnter"
|
||||
|
|
@ -341,7 +341,7 @@
|
|||
/>
|
||||
</span>
|
||||
<el-divider direction="vertical" />
|
||||
<template v-if="datasetDetail.type === 0">
|
||||
<template v-if="knowledgeDetail.type === 0">
|
||||
<span
|
||||
class="mr-4"
|
||||
v-if="
|
||||
|
|
@ -401,7 +401,7 @@
|
|||
<el-icon><Connection /></el-icon>
|
||||
{{ $t('views.document.generateQuestion.title') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDatasetDialog(row)">
|
||||
<el-dropdown-item @click="openknowledgeDialog(row)">
|
||||
<AppIcon iconName="app-migrate"></AppIcon>
|
||||
{{ $t('views.document.setting.migration') }}
|
||||
</el-dropdown-item>
|
||||
|
|
@ -421,7 +421,7 @@
|
|||
</el-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="datasetDetail.type === 1 || datasetDetail.type === 2">
|
||||
<template v-if="knowledgeDetail.type === 1 || knowledgeDetail.type === 2">
|
||||
<span class="mr-4">
|
||||
<el-button
|
||||
type="primary"
|
||||
|
|
@ -483,7 +483,7 @@
|
|||
<el-icon><Connection /></el-icon>
|
||||
{{ $t('views.document.generateQuestion.title') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDatasetDialog(row)">
|
||||
<el-dropdown-item @click="openknowledgeDialog(row)">
|
||||
<AppIcon iconName="app-migrate"></AppIcon>
|
||||
{{ $t('views.document.setting.migration') }}</el-dropdown-item
|
||||
>
|
||||
|
|
@ -530,7 +530,7 @@
|
|||
<ImportDocumentDialog ref="ImportDocumentDialogRef" :title="title" @refresh="refresh" />
|
||||
<SyncWebDialog ref="SyncWebDialogRef" @refresh="refresh" />
|
||||
<!-- 选择知识库 -->
|
||||
<SelectDatasetDialog ref="SelectDatasetDialogRef" @refresh="refreshMigrate" />
|
||||
<SelectKnowledgeDialog ref="SelectKnowledgeDialogRef" @refresh="refreshMigrate" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -541,7 +541,7 @@ import { ElTable } from 'element-plus'
|
|||
import documentApi from '@/api/shared/document'
|
||||
import ImportDocumentDialog from './component/ImportDocumentDialog.vue'
|
||||
import SyncWebDialog from '@/views/knowledge/component/SyncWebDialog.vue'
|
||||
import SelectDatasetDialog from './component/SelectDatasetDialog.vue'
|
||||
import SelectKnowledgeDialog from './component/SelectKnowledgeDialog.vue'
|
||||
import { numberFormat } from '@/utils/common'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { hitHandlingMethod } from '@/enums/document'
|
||||
|
|
@ -556,7 +556,7 @@ import { t } from '@/locales'
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, folderId }, // id为datasetID
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const { common, knowledge, document } = useStore()
|
||||
|
|
@ -591,7 +591,7 @@ const filterMethod = ref<any>({})
|
|||
const orderBy = ref<string>('')
|
||||
const documentData = ref<any[]>([])
|
||||
const currentMouseId = ref(null)
|
||||
const datasetDetail = ref<any>({})
|
||||
const knowledgeDetail = ref<any>({})
|
||||
|
||||
const paginationConfig = ref({
|
||||
current_page: 1,
|
||||
|
|
@ -604,16 +604,16 @@ const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
|||
const multipleSelection = ref<any[]>([])
|
||||
const title = ref('')
|
||||
|
||||
const SelectDatasetDialogRef = ref()
|
||||
const SelectknowledgeDialogRef = ref()
|
||||
|
||||
const exportDocument = (document: any) => {
|
||||
documentApi.exportDocument(document.name, document.dataset_id, document.id, loading).then(() => {
|
||||
documentApi.exportDocument(document.name, document.knowledge_id, document.id, loading).then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
})
|
||||
}
|
||||
const exportDocumentZip = (document: any) => {
|
||||
documentApi
|
||||
.exportDocumentZip(document.name, document.dataset_id, document.id, loading)
|
||||
.exportDocumentZip(document.name, document.knowledge_id, document.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
})
|
||||
|
|
@ -640,7 +640,7 @@ function clearSelection() {
|
|||
multipleTableRef.value?.clearSelection()
|
||||
}
|
||||
|
||||
function openDatasetDialog(row?: any) {
|
||||
function openknowledgeDialog(row?: any) {
|
||||
const arr: string[] = []
|
||||
if (row) {
|
||||
arr.push(row.id)
|
||||
|
|
@ -652,7 +652,7 @@ function openDatasetDialog(row?: any) {
|
|||
})
|
||||
}
|
||||
|
||||
SelectDatasetDialogRef.value.open(arr)
|
||||
SelectknowledgeDialogRef.value.open(arr)
|
||||
}
|
||||
|
||||
function dropdownHandle(obj: any) {
|
||||
|
|
@ -673,7 +673,7 @@ function beforeCommand(attr: string, val: any, task_type?: number) {
|
|||
}
|
||||
|
||||
const cancelTask = (row: any, task_type: number) => {
|
||||
documentApi.putCancelTask(row.dataset_id, row.id, { type: task_type }).then(() => {
|
||||
documentApi.putCancelTask(row.knowledge_id, row.id, { type: task_type }).then(() => {
|
||||
MsgSuccess(t('views.document.tip.sendMessage'))
|
||||
})
|
||||
}
|
||||
|
|
@ -745,7 +745,7 @@ function syncWebDocument(row: any) {
|
|||
confirmButtonClass: 'danger',
|
||||
})
|
||||
.then(() => {
|
||||
documentApi.putDocumentSync(row.dataset_id, row.id).then(() => {
|
||||
documentApi.putDocumentSync(row.knowledge_id, row.id).then(() => {
|
||||
getList()
|
||||
})
|
||||
})
|
||||
|
|
@ -762,7 +762,7 @@ function syncWebDocument(row: any) {
|
|||
|
||||
function refreshDocument(row: any) {
|
||||
const embeddingDocument = (stateList: Array<string>) => {
|
||||
return documentApi.putDocumentRefresh(row.dataset_id, row.id, stateList).then(() => {
|
||||
return documentApi.putDocumentRefresh(row.knowledge_id, row.id, stateList).then(() => {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
|
@ -782,7 +782,7 @@ function rowClickHandle(row: any, column: any) {
|
|||
*/
|
||||
function creatQuickHandle(val: string) {
|
||||
loading.value = true
|
||||
const obj = [{ name: val }]
|
||||
const obj = [{ name: val }]
|
||||
document
|
||||
.asyncPostDocument(id, obj)
|
||||
.then(() => {
|
||||
|
|
@ -848,7 +848,7 @@ function deleteMulDocument() {
|
|||
function batchRefresh() {
|
||||
const arr: string[] = multipleSelection.value.map((v) => v.id)
|
||||
const embeddingBatchDocument = (stateList: Array<string>) => {
|
||||
documentApi.batchRefresh(id, arr, stateList, loading).then(() => {
|
||||
documentApi.putBatchRefresh(id, arr, stateList, loading).then(() => {
|
||||
MsgSuccess(t('views.document.tip.vectorizationSuccess'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
})
|
||||
|
|
@ -945,7 +945,7 @@ function getList(bool?: boolean) {
|
|||
|
||||
function getDetail() {
|
||||
knowledge.asyncGetKnowledgeDetail(id, loading).then((res: any) => {
|
||||
datasetDetail.value = res.data
|
||||
knowledgeDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@
|
|||
<el-button @click="router.push({ path: `/knowledge` })">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toDataset')
|
||||
}}</el-button>
|
||||
<el-button type="primary" @click="router.push({ path: `/knowledge/${data?.id}/${currentFolder.id}/document` })">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toDocument')
|
||||
}}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="router.push({ path: `/knowledge/${data?.id}/${folderId}/document` })"
|
||||
>{{ $t('views.knowledge.ResultSuccess.buttons.toDocument') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-result>
|
||||
<div class="result-success">
|
||||
|
|
@ -52,7 +54,8 @@
|
|||
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
|
||||
</el-text>
|
||||
<el-text v-else-if="item.status === '0'">
|
||||
<el-icon class="is-loading primary"><Loading /></el-icon> {{ $t('views.knowledge.ResultSuccess.loading') }}...
|
||||
<el-icon class="is-loading primary"><Loading /></el-icon>
|
||||
{{ $t('views.knowledge.ResultSuccess.loading') }}...
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -62,23 +65,28 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { filesize, getImgUrl } from '@/utils/utils'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
default: () => {},
|
||||
},
|
||||
})
|
||||
const router = useRouter()
|
||||
|
||||
const {
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
const paragraph_count = computed(() =>
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.paragraph_count), 0)
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.paragraph_count), 0),
|
||||
)
|
||||
|
||||
const char_length = computed(
|
||||
() =>
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.char_length), 0) || 0
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.char_length), 0) || 0,
|
||||
)
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:title="$t('views.chatLog.selectKnowledge')"
|
||||
v-model="dialogVisible"
|
||||
width="600"
|
||||
class="select-dataset-dialog"
|
||||
class="select-knowledge-dialog"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<el-scrollbar height="500">
|
||||
<div class="p-16">
|
||||
<el-row :gutter="12" v-loading="loading">
|
||||
<el-col :span="12" v-for="(item, index) in datasetList" :key="index" class="mb-16">
|
||||
<el-col :span="12" v-for="(item, index) in knowledgeList" :key="index" class="mb-16">
|
||||
<el-card shadow="never" :class="item.id === selectKnowledge ? 'active' : ''">
|
||||
<el-radio :value="item.id" size="large">
|
||||
<div class="flex align-center">
|
||||
|
|
@ -57,7 +57,7 @@ import useStore from '@/stores'
|
|||
const { knowledge } = useStore()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }, // id为datasetID
|
||||
params: { id }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -66,20 +66,20 @@ const loading = ref<boolean>(false)
|
|||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
const selectKnowledge = ref('')
|
||||
const datasetList = ref<any>([])
|
||||
const knowledgeList = ref<any>([])
|
||||
const documentList = ref<any>([])
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
selectKnowledge.value = ''
|
||||
datasetList.value = []
|
||||
knowledgeList.value = []
|
||||
documentList.value = []
|
||||
}
|
||||
})
|
||||
|
||||
const open = (list: any) => {
|
||||
documentList.value = list
|
||||
getDataset()
|
||||
getKnowledge()
|
||||
dialogVisible.value = true
|
||||
}
|
||||
const submitHandle = () => {
|
||||
|
|
@ -91,20 +91,20 @@ const submitHandle = () => {
|
|||
})
|
||||
}
|
||||
|
||||
function getDataset() {
|
||||
function getKnowledge() {
|
||||
knowledge.asyncGetRootKnowledge(loading).then((res: any) => {
|
||||
datasetList.value = res.data?.filter((v: any) => v.id !== id)
|
||||
knowledgeList.value = res.data?.filter((v: any) => v.id !== id)
|
||||
})
|
||||
}
|
||||
|
||||
const refresh = () => {
|
||||
getDataset()
|
||||
getKnowledge()
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.select-dataset-dialog {
|
||||
.select-knowledge-dialog {
|
||||
padding: 0;
|
||||
.el-dialog__header {
|
||||
padding: 24px 24px 0 24px;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
<div class="flex-between">
|
||||
<div>
|
||||
<el-button
|
||||
v-if="datasetDetail.type === 0"
|
||||
v-if="knowledgeDetail.type === 0"
|
||||
type="primary"
|
||||
@click="router.push({ path: '/knowledge/document/upload', query: { id: id } })"
|
||||
>{{ $t('views.document.uploadDocument') }}
|
||||
</el-button>
|
||||
<el-button v-if="datasetDetail.type === 1" type="primary" @click="importDoc"
|
||||
<el-button v-if="knowledgeDetail.type === 1" type="primary" @click="importDoc"
|
||||
>{{ $t('views.document.importDocument') }}
|
||||
</el-button>
|
||||
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<el-button @click="openGenerateDialog()" :disabled="multipleSelection.length === 0">
|
||||
{{ $t('views.document.generateQuestion.title') }}
|
||||
</el-button>
|
||||
<el-button @click="openDatasetDialog()" :disabled="multipleSelection.length === 0">
|
||||
<el-button @click="openknowledgeDialog()" :disabled="multipleSelection.length === 0">
|
||||
{{ $t('views.document.setting.migration') }}
|
||||
</el-button>
|
||||
<el-dropdown>
|
||||
|
|
@ -41,17 +41,17 @@
|
|||
divided
|
||||
@click="syncMulDocument"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
v-if="datasetDetail.type === 1"
|
||||
v-if="knowledgeDetail.type === 1"
|
||||
>{{ $t('views.document.syncDocument') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
divided
|
||||
v-if="datasetDetail.type === 2"
|
||||
v-if="knowledgeDetail.type === 2"
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: '/knowledge/import',
|
||||
query: { id: id, folder_token: datasetDetail.meta.folder_token },
|
||||
query: { id: id, folder_token: knowledgeDetail.meta.folder_token },
|
||||
})
|
||||
"
|
||||
>{{ $t('views.document.importDocument') }}
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
divided
|
||||
@click="syncLarkMulDocument"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
v-if="datasetDetail.type === 2"
|
||||
v-if="knowledgeDetail.type === 2"
|
||||
>{{ $t('views.document.syncDocument') }}
|
||||
</el-dropdown-item>
|
||||
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
class="mt-16"
|
||||
:data="documentData"
|
||||
:pagination-config="paginationConfig"
|
||||
:quick-create="datasetDetail.type === 0"
|
||||
:quick-create="knowledgeDetail.type === 0"
|
||||
@sizeChange="handleSizeChange"
|
||||
@changePage="getList"
|
||||
@cell-mouse-enter="cellMouseEnter"
|
||||
|
|
@ -336,7 +336,7 @@
|
|||
/>
|
||||
</span>
|
||||
<el-divider direction="vertical" />
|
||||
<template v-if="datasetDetail.type === 0">
|
||||
<template v-if="knowledgeDetail.type === 0">
|
||||
<span
|
||||
class="mr-4"
|
||||
v-if="
|
||||
|
|
@ -396,7 +396,7 @@
|
|||
<el-icon><Connection /></el-icon>
|
||||
{{ $t('views.document.generateQuestion.title') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDatasetDialog(row)">
|
||||
<el-dropdown-item @click="openknowledgeDialog(row)">
|
||||
<AppIcon iconName="app-migrate"></AppIcon>
|
||||
{{ $t('views.document.setting.migration') }}
|
||||
</el-dropdown-item>
|
||||
|
|
@ -416,7 +416,7 @@
|
|||
</el-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="datasetDetail.type === 1 || datasetDetail.type === 2">
|
||||
<template v-if="knowledgeDetail.type === 1 || knowledgeDetail.type === 2">
|
||||
<span class="mr-4">
|
||||
<el-button
|
||||
type="primary"
|
||||
|
|
@ -478,7 +478,7 @@
|
|||
<el-icon><Connection /></el-icon>
|
||||
{{ $t('views.document.generateQuestion.title') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDatasetDialog(row)">
|
||||
<el-dropdown-item @click="openknowledgeDialog(row)">
|
||||
<AppIcon iconName="app-migrate"></AppIcon>
|
||||
{{ $t('views.document.setting.migration') }}</el-dropdown-item
|
||||
>
|
||||
|
|
@ -551,7 +551,7 @@ import { t } from '@/locales'
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, folderId }, // id为datasetID
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const { common, knowledge, document } = useStore()
|
||||
|
|
@ -586,7 +586,7 @@ const filterMethod = ref<any>({})
|
|||
const orderBy = ref<string>('')
|
||||
const documentData = ref<any[]>([])
|
||||
const currentMouseId = ref(null)
|
||||
const datasetDetail = ref<any>({})
|
||||
const knowledgeDetail = ref<any>({})
|
||||
|
||||
const paginationConfig = ref({
|
||||
current_page: 1,
|
||||
|
|
@ -602,13 +602,13 @@ const title = ref('')
|
|||
const selectKnowledgeDialogRef = ref()
|
||||
|
||||
const exportDocument = (document: any) => {
|
||||
documentApi.exportDocument(document.name, document.dataset_id, document.id, loading).then(() => {
|
||||
documentApi.exportDocument(document.name, document.knowledge_id, document.id, loading).then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
})
|
||||
}
|
||||
const exportDocumentZip = (document: any) => {
|
||||
documentApi
|
||||
.exportDocumentZip(document.name, document.dataset_id, document.id, loading)
|
||||
.exportDocumentZip(document.name, document.knowledge_id, document.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
})
|
||||
|
|
@ -635,7 +635,7 @@ function clearSelection() {
|
|||
multipleTableRef.value?.clearSelection()
|
||||
}
|
||||
|
||||
function openDatasetDialog(row?: any) {
|
||||
function openknowledgeDialog(row?: any) {
|
||||
const arr: string[] = []
|
||||
if (row) {
|
||||
arr.push(row.id)
|
||||
|
|
@ -668,7 +668,7 @@ function beforeCommand(attr: string, val: any, task_type?: number) {
|
|||
}
|
||||
|
||||
const cancelTask = (row: any, task_type: number) => {
|
||||
documentApi.putCancelTask(row.dataset_id, row.id, { type: task_type }).then(() => {
|
||||
documentApi.putCancelTask(row.knowledge_id, row.id, { type: task_type }).then(() => {
|
||||
MsgSuccess(t('views.document.tip.sendMessage'))
|
||||
})
|
||||
}
|
||||
|
|
@ -740,7 +740,7 @@ function syncWebDocument(row: any) {
|
|||
confirmButtonClass: 'color-danger',
|
||||
})
|
||||
.then(() => {
|
||||
documentApi.putDocumentSync(row.dataset_id, row.id).then(() => {
|
||||
documentApi.putDocumentSync(row.knowledge_id, row.id).then(() => {
|
||||
getList()
|
||||
})
|
||||
})
|
||||
|
|
@ -757,7 +757,7 @@ function syncWebDocument(row: any) {
|
|||
|
||||
function refreshDocument(row: any) {
|
||||
const embeddingDocument = (stateList: Array<string>) => {
|
||||
return documentApi.putDocumentRefresh(row.dataset_id, row.id, stateList).then(() => {
|
||||
return documentApi.putDocumentRefresh(row.knowledge_id, row.id, stateList).then(() => {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
|
@ -843,7 +843,7 @@ function deleteMulDocument() {
|
|||
function batchRefresh() {
|
||||
const arr: string[] = multipleSelection.value.map((v) => v.id)
|
||||
const embeddingBatchDocument = (stateList: Array<string>) => {
|
||||
documentApi.batchRefresh(id, arr, stateList, loading).then(() => {
|
||||
documentApi.putBatchRefresh(id, arr, stateList, loading).then(() => {
|
||||
MsgSuccess(t('views.document.tip.vectorizationSuccess'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
})
|
||||
|
|
@ -940,7 +940,7 @@ function getList(bool?: boolean) {
|
|||
|
||||
function getDetail() {
|
||||
knowledge.asyncGetKnowledgeDetail(id, loading).then((res: any) => {
|
||||
datasetDetail.value = res.data
|
||||
knowledgeDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@
|
|||
</template>
|
||||
<template #extra>
|
||||
<el-button @click="router.push({ path: `/knowledge` })">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toDataset')
|
||||
}}</el-button>
|
||||
<el-button type="primary" @click="router.push({ path: `/knowledge/${data?.id}/${currentFolder.id}/document` })">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toDocument')
|
||||
$t('views.knowledge.ResultSuccess.buttons.toknowledge')
|
||||
}}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="router.push({ path: `/knowledge/${data?.id}/${folderId}/document` })"
|
||||
>{{ $t('views.knowledge.ResultSuccess.buttons.toDocument') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-result>
|
||||
<div class="result-success">
|
||||
|
|
@ -52,7 +54,8 @@
|
|||
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
|
||||
</el-text>
|
||||
<el-text v-else-if="item.status === '0'">
|
||||
<el-icon class="is-loading primary"><Loading /></el-icon> {{ $t('views.knowledge.ResultSuccess.loading') }}...
|
||||
<el-icon class="is-loading primary"><Loading /></el-icon>
|
||||
{{ $t('views.knowledge.ResultSuccess.loading') }}...
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -62,23 +65,28 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { filesize, getImgUrl } from '@/utils/utils'
|
||||
const route = useRoute()
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
default: () => {},
|
||||
},
|
||||
})
|
||||
|
||||
const {
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
const router = useRouter()
|
||||
const paragraph_count = computed(() =>
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.paragraph_count), 0)
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.paragraph_count), 0),
|
||||
)
|
||||
|
||||
const char_length = computed(
|
||||
() =>
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.char_length), 0) || 0
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.char_length), 0) || 0,
|
||||
)
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ defineExpose({
|
|||
width: 100%;
|
||||
|
||||
.left-height {
|
||||
max-height: calc(var(--create-dataset-height) - 110px);
|
||||
max-height: calc(var(--create-knowledge-height) - 110px);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,19 +312,19 @@ function getHitTestList() {
|
|||
...formInline.value,
|
||||
}
|
||||
if (isDataset.value) {
|
||||
knowledgeApi.getDatasetHitTest(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.getKnowledgeHitTest(id, obj, loading).then((res) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
questionTitle.value = inputValue.value
|
||||
inputValue.value = ''
|
||||
first.value = false
|
||||
})
|
||||
} else if (isApplication.value) {
|
||||
applicationApi.getApplicationHitTest(id, obj, loading).then((res) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
questionTitle.value = inputValue.value
|
||||
inputValue.value = ''
|
||||
first.value = false
|
||||
})
|
||||
// applicationApi.getApplicationHitTest(id, obj, loading).then((res) => {
|
||||
// paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
// questionTitle.value = inputValue.value
|
||||
// inputValue.value = ''
|
||||
// first.value = false
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,19 +312,19 @@ function getHitTestList() {
|
|||
...formInline.value,
|
||||
}
|
||||
if (isDataset.value) {
|
||||
knowledgeApi.getDatasetHitTest(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.getKnowledgeHitTest(id, obj, loading).then((res) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
questionTitle.value = inputValue.value
|
||||
inputValue.value = ''
|
||||
first.value = false
|
||||
})
|
||||
} else if (isApplication.value) {
|
||||
applicationApi.getApplicationHitTest(id, obj, loading).then((res) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
questionTitle.value = inputValue.value
|
||||
inputValue.value = ''
|
||||
first.value = false
|
||||
})
|
||||
// applicationApi.getApplicationHitTest(id, obj, loading).then((res) => {
|
||||
// paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
// questionTitle.value = inputValue.value
|
||||
// inputValue.value = ''
|
||||
// first.value = false
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ import knowledgeApi from '@/api/shared/knowledge'
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
query: { id, folder_token } // id为knowledgeID,有id的是上传文档 folder_token为飞书文件夹token
|
||||
query: { id, folder_token }, // id为knowledgeID,有id的是上传文档 folder_token为飞书文件夹token
|
||||
} = route
|
||||
const knowledgeId = id as string
|
||||
const folderToken = folder_token as string
|
||||
|
|
@ -165,20 +165,20 @@ interface Tree {
|
|||
|
||||
const form = ref({
|
||||
fileType: 'txt',
|
||||
fileList: [] as any
|
||||
fileList: [] as any,
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
fileList: [
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' }
|
||||
]
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' },
|
||||
],
|
||||
})
|
||||
|
||||
const props = {
|
||||
label: 'name',
|
||||
children: 'zones',
|
||||
isLeaf: (data: any) => data.type !== 'folder',
|
||||
disabled: (data: any) => data.is_exist
|
||||
disabled: (data: any) => data.is_exist,
|
||||
}
|
||||
|
||||
const loadNode = (node: Node, resolve: (nodeData: Tree[]) => void) => {
|
||||
|
|
@ -225,7 +225,7 @@ function submit() {
|
|||
return {
|
||||
name: node.name,
|
||||
token: node.token,
|
||||
type: node.type
|
||||
type: node.type,
|
||||
}
|
||||
})
|
||||
if (newList.length === 0) {
|
||||
|
|
@ -234,7 +234,7 @@ function submit() {
|
|||
loading.value = false
|
||||
return
|
||||
}
|
||||
knowledge
|
||||
knowledgeApi
|
||||
.importLarkDocument(knowledgeId, newList, loading)
|
||||
.then((res) => {
|
||||
MsgSuccess(t('views.document.tip.importMessage'))
|
||||
|
|
|
|||
|
|
@ -230,11 +230,11 @@ async function submit() {
|
|||
})
|
||||
.then(() => {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
// KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
// KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
// MsgSuccess(t('common.saveSuccess'))
|
||||
// })
|
||||
// })
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
|
|
@ -246,11 +246,11 @@ async function submit() {
|
|||
.catch(() => {})
|
||||
} else {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
// KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
// KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
// MsgSuccess(t('common.saveSuccess'))
|
||||
// })
|
||||
// })
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<!-- 基本信息 -->
|
||||
<BaseForm ref="BaseFormRef" v-if="dialogVisible" />
|
||||
<el-form
|
||||
ref="DatasetFormRef"
|
||||
ref="KnowledgeFormRef"
|
||||
:rules="rules"
|
||||
:model="datasetForm"
|
||||
label-position="top"
|
||||
|
|
@ -63,7 +63,7 @@ const emit = defineEmits(['refresh'])
|
|||
|
||||
const router = useRouter()
|
||||
const BaseFormRef = ref()
|
||||
const DatasetFormRef = ref()
|
||||
const KnowledgeFormRef = ref()
|
||||
|
||||
const loading = ref(false)
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
|
@ -129,7 +129,7 @@ watch(dialogVisible, (bool) => {
|
|||
source_url: '',
|
||||
selector: '',
|
||||
}
|
||||
DatasetFormRef.value?.clearValidate()
|
||||
KnowledgeFormRef.value?.clearValidate()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -139,14 +139,16 @@ const open = () => {
|
|||
|
||||
const submitHandle = async () => {
|
||||
if (await BaseFormRef.value?.validate()) {
|
||||
await DatasetFormRef.value.validate((valid: any) => {
|
||||
await KnowledgeFormRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
const obj = { ...BaseFormRef.value.form, ...datasetForm.value }
|
||||
KnowledgeApi.postLarkKnowledge({...obj, embedding_model_id: obj.embedding }, loading).then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||
emit('refresh')
|
||||
})
|
||||
KnowledgeApi.postLarkKnowledge({ ...obj, embedding_model_id: obj.embedding }, loading).then(
|
||||
(res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||
emit('refresh')
|
||||
},
|
||||
)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<LayoutContainer :header="$t('views.document.importDocument')" class="create-dataset">
|
||||
<LayoutContainer :header="$t('views.document.importDocument')" class="create-knowledge">
|
||||
<template #backButton>
|
||||
<back-button @click="back"></back-button>
|
||||
</template>
|
||||
<div class="create-dataset__main flex" v-loading="loading">
|
||||
<div class="create-dataset__component main-calc-height">
|
||||
<div class="create-knowledge__main flex" v-loading="loading">
|
||||
<div class="create-knowledge__component main-calc-height">
|
||||
<div class="upload-document p-24" style="min-width: 850px">
|
||||
<h4 class="title-decoration-1 mb-8">
|
||||
{{ $t('views.document.feishu.selectDocument') }}
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="create-dataset__footer text-right border-t">
|
||||
<div class="create-knowledge__footer text-right border-t">
|
||||
<el-button @click="router.go(-1)">{{ $t('common.cancel') }}</el-button>
|
||||
|
||||
<el-button @click="submit" type="primary" :disabled="disabled">
|
||||
|
|
@ -145,7 +145,7 @@ import knowledgeApi from '@/api/knowledge/knowledge'
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
query: { id, folder_token } // id为knowledgeID,有id的是上传文档 folder_token为飞书文件夹token
|
||||
query: { id, folder_token }, // id为knowledgeID,有id的是上传文档 folder_token为飞书文件夹token
|
||||
} = route
|
||||
const knowledgeId = id as string
|
||||
const folderToken = folder_token as string
|
||||
|
|
@ -165,20 +165,20 @@ interface Tree {
|
|||
|
||||
const form = ref({
|
||||
fileType: 'txt',
|
||||
fileList: [] as any
|
||||
fileList: [] as any,
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
fileList: [
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' }
|
||||
]
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' },
|
||||
],
|
||||
})
|
||||
|
||||
const props = {
|
||||
label: 'name',
|
||||
children: 'zones',
|
||||
isLeaf: (data: any) => data.type !== 'folder',
|
||||
disabled: (data: any) => data.is_exist
|
||||
disabled: (data: any) => data.is_exist,
|
||||
}
|
||||
|
||||
const loadNode = (node: Node, resolve: (nodeData: Tree[]) => void) => {
|
||||
|
|
@ -225,7 +225,7 @@ function submit() {
|
|||
return {
|
||||
name: node.name,
|
||||
token: node.token,
|
||||
type: node.type
|
||||
type: node.type,
|
||||
}
|
||||
})
|
||||
if (newList.length === 0) {
|
||||
|
|
@ -234,7 +234,7 @@ function submit() {
|
|||
loading.value = false
|
||||
return
|
||||
}
|
||||
knowledge
|
||||
knowledgeApi
|
||||
.importLarkDocument(knowledgeId, newList, loading)
|
||||
.then((res) => {
|
||||
MsgSuccess(t('views.document.tip.importMessage'))
|
||||
|
|
@ -255,7 +255,7 @@ function back() {
|
|||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.create-dataset {
|
||||
.create-knowledge {
|
||||
&__component {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
|
|
|
|||
|
|
@ -230,11 +230,11 @@ async function submit() {
|
|||
})
|
||||
.then(() => {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
// KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
// KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
// MsgSuccess(t('common.saveSuccess'))
|
||||
// })
|
||||
// })
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
|
|
@ -246,11 +246,11 @@ async function submit() {
|
|||
.catch(() => {})
|
||||
} else {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
// KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
// KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
// MsgSuccess(t('common.saveSuccess'))
|
||||
// })
|
||||
// })
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
|
|
|
|||
|
|
@ -142,11 +142,11 @@ const submitHandle = async () => {
|
|||
await DatasetFormRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
const obj = { ...BaseFormRef.value.form, ...datasetForm.value }
|
||||
KnowledgeApi.postLarkKnowledge(obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||
emit('refresh')
|
||||
})
|
||||
// KnowledgeApi.postLarkKnowledge(obj, loading).then((res) => {
|
||||
// MsgSuccess(t('common.createSuccess'))
|
||||
// router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||
// emit('refresh')
|
||||
// })
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,13 @@
|
|||
>
|
||||
</el-input>
|
||||
|
||||
<img :src="identifyCode" alt="" height="38" class="ml-8 cursor border border-r-4"
|
||||
@click="makeCode"/>
|
||||
<img
|
||||
:src="identifyCode"
|
||||
alt=""
|
||||
height="38"
|
||||
class="ml-8 cursor border border-r-4"
|
||||
@click="makeCode"
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
|
@ -74,7 +79,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-if="showQrCodeTab">
|
||||
<QrCodeTab :tabs="orgOptions"/>
|
||||
<QrCodeTab :tabs="orgOptions" />
|
||||
</div>
|
||||
<div class="login-gradient-divider lighter mt-24" v-if="modeList.length > 1">
|
||||
<span>{{ $t('views.login.moreMethod') }}</span>
|
||||
|
|
@ -91,7 +96,7 @@
|
|||
<span
|
||||
:style="{
|
||||
'font-size': item === 'OAUTH2' ? '8px' : '10px',
|
||||
color: user.themeInfo?.theme
|
||||
color: user.themeInfo?.theme,
|
||||
}"
|
||||
>{{ item }}</span
|
||||
>
|
||||
|
|
@ -120,24 +125,24 @@
|
|||
</login-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {onMounted, ref, onBeforeMount} from 'vue'
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
import type {FormInstance, FormRules} from 'element-plus'
|
||||
import type {LoginRequest} from '@/api/type/login'
|
||||
import { onMounted, ref, onBeforeMount } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { LoginRequest } from '@/api/type/login'
|
||||
import LoginContainer from '@/layout/login-layout/LoginContainer.vue'
|
||||
import LoginLayout from '@/layout/login-layout/LoginLayout.vue'
|
||||
import loginApi from '@/api/user/login'
|
||||
import authApi from '@/api/system-settings/auth-setting'
|
||||
import {t, getBrowserLang} from '@/locales'
|
||||
import { t, getBrowserLang } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
import QrCodeTab from "@/views/login/scanCompinents/QrCodeTab.vue";
|
||||
import {MsgConfirm, MsgError} from "@/utils/message.ts";
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import QrCodeTab from '@/views/login/scanCompinents/QrCodeTab.vue'
|
||||
import { MsgConfirm, MsgError } from '@/utils/message.ts'
|
||||
import * as dd from 'dingtalk-jsapi'
|
||||
import { loadScript } from '@/utils/utils'
|
||||
const router = useRouter()
|
||||
const {login, user, theme} = useStore()
|
||||
const {locale} = useI18n({useScope: 'global'})
|
||||
const { login, user, theme } = useStore()
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
const loading = ref<boolean>(false)
|
||||
|
||||
const identifyCode = ref<string>('')
|
||||
|
|
@ -178,13 +183,13 @@ const loginHandle = () => {
|
|||
if (loginMode.value === 'LDAP') {
|
||||
login.asyncLdapLogin(loginForm.value, loading).then(() => {
|
||||
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
|
||||
router.push({name: 'home'})
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
} else {
|
||||
login.asyncLogin(loginForm.value, loading).then(() => {
|
||||
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
|
||||
localStorage.setItem('workspace_id', 'default')
|
||||
router.push({name: 'home'})
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
@ -231,7 +236,7 @@ function redirectAuth(authType: string) {
|
|||
MsgConfirm(t('views.login.jump_tip'), '', {
|
||||
confirmButtonText: t('views.login.jump'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
confirmButtonClass: ''
|
||||
confirmButtonClass: '',
|
||||
})
|
||||
.then(() => {
|
||||
if (!res.data.config) {
|
||||
|
|
@ -267,8 +272,7 @@ function redirectAuth(authType: string) {
|
|||
window.location.href = url
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
.catch(() => {})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +287,7 @@ function changeMode(val: string) {
|
|||
loginForm.value = {
|
||||
username: '',
|
||||
password: '',
|
||||
captcha: ''
|
||||
captcha: '',
|
||||
}
|
||||
redirectAuth(val)
|
||||
loginFormRef.value?.clearValidate()
|
||||
|
|
@ -293,7 +297,7 @@ onBeforeMount(() => {
|
|||
loading.value = true
|
||||
user.asyncGetProfile().then((res) => {
|
||||
if (user.isEnterprise()) {
|
||||
user
|
||||
login
|
||||
.getAuthType()
|
||||
.then((res) => {
|
||||
//如果结果包含LDAP,把LDAP放在第一个
|
||||
|
|
@ -305,7 +309,7 @@ onBeforeMount(() => {
|
|||
modeList.value = [...modeList.value, ...res]
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
user
|
||||
login
|
||||
.getQrType()
|
||||
.then((res) => {
|
||||
if (res.length > 0) {
|
||||
|
|
@ -319,7 +323,7 @@ onBeforeMount(() => {
|
|||
? t('views.system.authentication.scanTheQRCode.wecom')
|
||||
: item === 'dingtalk'
|
||||
? t('views.system.authentication.scanTheQRCode.dingtalk')
|
||||
: t('views.system.authentication.scanTheQRCode.lark')
|
||||
: t('views.system.authentication.scanTheQRCode.lark'),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -344,7 +348,7 @@ onMounted(() => {
|
|||
if (code) {
|
||||
dd.runtime.permission.requestAuthCode({ corpId: code }).then((res) => {
|
||||
console.log('DingTalk client request success:', res)
|
||||
user.dingOauth2Callback(res.code).then(() => {
|
||||
login.dingOauth2Callback(res.code).then(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
})
|
||||
|
|
@ -357,19 +361,19 @@ onMounted(() => {
|
|||
window.tt?.requestAuthCode({
|
||||
appId: appId,
|
||||
success: (res: any) => {
|
||||
user.larkCallback(res.code).then(() => {
|
||||
login.larkCallback(res.code).then(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
},
|
||||
fail: (error: any) => {
|
||||
MsgError(error)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
loadScript('https://lf-scm-cn.feishucdn.com/lark/op/h5-js-sdk-1.5.35.js', {
|
||||
jsId: 'lark-sdk',
|
||||
forceReload: true
|
||||
forceReload: true,
|
||||
})
|
||||
.then(() => {
|
||||
if (window.tt) {
|
||||
|
|
@ -377,7 +381,7 @@ onMounted(() => {
|
|||
appID: appId,
|
||||
scopeList: [],
|
||||
success: (res: any) => {
|
||||
user.larkCallback(res.code).then(() => {
|
||||
login.larkCallback(res.code).then(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
},
|
||||
|
|
@ -386,7 +390,7 @@ onMounted(() => {
|
|||
if (errno === 103) {
|
||||
callRequestAuthCode()
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
} else {
|
||||
callRequestAuthCode()
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ const activeKey = ref('')
|
|||
const allConfigs = ref<PlatformConfig[]>([])
|
||||
const config = ref<Config>({ app_key: '', app_secret: '' })
|
||||
// const logoUrl = ref('')
|
||||
const { user } = useStore()
|
||||
const { login } = useStore()
|
||||
async function getPlatformInfo() {
|
||||
try {
|
||||
return await user.getQrSource()
|
||||
return await login.getQrSource()
|
||||
} catch (error) {
|
||||
return []
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const props = defineProps<{
|
|||
}>()
|
||||
|
||||
const router = useRouter()
|
||||
const { user } = useStore()
|
||||
const { login } = useStore()
|
||||
const { load } = useScriptTag('https://g.alicdn.com/dingding/h5-dingtalk-login/0.21.0/ddlogin.js')
|
||||
const isConfigReady = ref(false)
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ const initActive = async () => {
|
|||
},
|
||||
(loginResult) => {
|
||||
const authCode = loginResult.authCode
|
||||
user.dingCallback(authCode).then(() => {
|
||||
login.dingCallback(authCode).then(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const router = useRouter()
|
|||
|
||||
const wwLogin = ref({})
|
||||
const obj = ref<any>({ isWeComLogin: false })
|
||||
const { user } = useStore()
|
||||
const { login } = useStore()
|
||||
|
||||
const props = defineProps<{
|
||||
config: {
|
||||
|
|
@ -53,7 +53,7 @@ const init = async () => {
|
|||
},
|
||||
onCheckWeComLogin: obj.value,
|
||||
async onLoginSuccess({ code }: any) {
|
||||
user.wecomCallback(code).then(() => {
|
||||
login.wecomCallback(code).then(() => {
|
||||
setTimeout(() => {
|
||||
router.push({ name: 'home' })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const {
|
|||
params: { id, documentId }, // id为knowledgeId
|
||||
} = route as any
|
||||
|
||||
const { problem } = useStore()
|
||||
const { problem, paragraph } = useStore()
|
||||
const inputRef = ref()
|
||||
const loading = ref(false)
|
||||
const isAddProblem = ref(false)
|
||||
|
|
@ -96,7 +96,7 @@ watch(
|
|||
|
||||
function delProblemHandle(item: any, index: number) {
|
||||
if (item.id) {
|
||||
problem
|
||||
paragraph
|
||||
.asyncDisassociationProblem(
|
||||
props.knowledgeId || id,
|
||||
documentId || props.docId,
|
||||
|
|
@ -134,7 +134,7 @@ function addProblem() {
|
|||
function addProblemHandle(val: string) {
|
||||
if (props.problemId) {
|
||||
const api = problemOptions.value.some((option) => option.id === val)
|
||||
? problem.asyncAssociationProblem(
|
||||
? paragraph.asyncAssociationProblem(
|
||||
props.knowledgeId || id,
|
||||
documentId || props.docId,
|
||||
props.problemId,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="`${$t('views.log.selectDataset')}/${$t('common.fileUpload.document')}`"
|
||||
:title="`${$t('views.chatLog.selectKnowledge')}/${$t('common.fileUpload.document')}`"
|
||||
v-model="dialogVisible"
|
||||
width="500"
|
||||
:close-on-click-modal="false"
|
||||
|
|
@ -14,18 +14,18 @@
|
|||
:rules="rules"
|
||||
@submit.prevent
|
||||
>
|
||||
<el-form-item :label="$t('views.log.selectDataset')" prop="dataset_id">
|
||||
<el-form-item :label="$t('views.chatLog.selectKnowledge')" prop="knowledge_id">
|
||||
<el-select
|
||||
v-model="form.dataset_id"
|
||||
v-model="form.knowledge_id"
|
||||
filterable
|
||||
:placeholder="$t('views.log.selectDatasetPlaceholder')"
|
||||
:placeholder="$t('views.chatLog.selectKnowledgePlaceholder')"
|
||||
:loading="optionLoading"
|
||||
@change="changeDataset"
|
||||
@change="changeknowledge"
|
||||
>
|
||||
<el-option v-for="item in datasetList" :key="item.id" :label="item.name" :value="item.id">
|
||||
<el-option v-for="item in knowledgeList" :key="item.id" :label="item.name" :value="item.id">
|
||||
<span class="flex align-center">
|
||||
<el-avatar
|
||||
v-if="!item.dataset_id && item.type === '1'"
|
||||
v-if="!item.knowledge_id && item.type === '1'"
|
||||
class="mr-12 avatar-purple"
|
||||
shape="square"
|
||||
:size="24"
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
<img src="@/assets/knowledge/icon_web.svg" style="width: 58%" alt="" />
|
||||
</el-avatar>
|
||||
<el-avatar
|
||||
v-else-if="!item.dataset_id && item.type === '2'"
|
||||
v-else-if="!item.knowledge_id && item.type === '2'"
|
||||
class="mr-12 avatar-purple"
|
||||
shape="square"
|
||||
:size="24"
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
<img src="@/assets/knowledge/logo_lark.svg" style="width: 100%" alt="" />
|
||||
</el-avatar>
|
||||
<el-avatar
|
||||
v-else-if="!item.dataset_id && item.type === '0'"
|
||||
v-else-if="!item.knowledge_id && item.type === '0'"
|
||||
class="mr-12 avatar-blue"
|
||||
shape="square"
|
||||
:size="24"
|
||||
|
|
@ -54,11 +54,11 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('views.log.saveToDocument')" prop="document_id">
|
||||
<el-form-item :label="$t('views.chatLog.saveToDocument')" prop="document_id">
|
||||
<el-select
|
||||
v-model="form.document_id"
|
||||
filterable
|
||||
:placeholder="$t('views.log.documentPlaceholder')"
|
||||
:placeholder="$t('views.chatLog.documentPlaceholder')"
|
||||
:loading="optionLoading"
|
||||
>
|
||||
<el-option
|
||||
|
|
@ -103,18 +103,18 @@ const dialogVisible = ref<boolean>(false)
|
|||
const loading = ref(false)
|
||||
|
||||
const form = ref<any>({
|
||||
dataset_id: '',
|
||||
knowledge_id: '',
|
||||
document_id: ''
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
dataset_id: [
|
||||
{ required: true, message: t('views.log.selectDatasetPlaceholder'), trigger: 'change' }
|
||||
knowledge_id: [
|
||||
{ required: true, message: t('views.chatLog.selectknowledgePlaceholder'), trigger: 'change' }
|
||||
],
|
||||
document_id: [{ required: true, message: t('views.log.documentPlaceholder'), trigger: 'change' }]
|
||||
document_id: [{ required: true, message: t('views.chatLog.documentPlaceholder'), trigger: 'change' }]
|
||||
})
|
||||
|
||||
const datasetList = ref<any[]>([])
|
||||
const knowledgeList = ref<any[]>([])
|
||||
const documentList = ref<any[]>([])
|
||||
const optionLoading = ref(false)
|
||||
const paragraphList = ref<string[]>([])
|
||||
|
|
@ -122,17 +122,17 @@ const paragraphList = ref<string[]>([])
|
|||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
form.value = {
|
||||
dataset_id: '',
|
||||
knowledge_id: '',
|
||||
document_id: ''
|
||||
}
|
||||
datasetList.value = []
|
||||
knowledgeList.value = []
|
||||
documentList.value = []
|
||||
paragraphList.value = []
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
})
|
||||
|
||||
function changeDataset(id: string) {
|
||||
function changeknowledge(id: string) {
|
||||
form.value.document_id = ''
|
||||
getDocument(id)
|
||||
}
|
||||
|
|
@ -143,15 +143,15 @@ function getDocument(id: string) {
|
|||
})
|
||||
}
|
||||
|
||||
function getDataset() {
|
||||
function getknowledge() {
|
||||
knowledge.asyncGetRootKnowledge(loading).then((res: any) => {
|
||||
datasetList.value = res.data
|
||||
knowledgeList.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
const open = (list: any) => {
|
||||
paragraphList.value = list
|
||||
getDataset()
|
||||
getknowledge()
|
||||
formRef.value?.clearValidate()
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|||
.putMigrateMulParagraph(
|
||||
id,
|
||||
documentId,
|
||||
form.value.dataset_id,
|
||||
form.value.knowledge_id,
|
||||
form.value.document_id,
|
||||
paragraphList.value,
|
||||
loading
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const {
|
|||
params: { id, documentId }, // id为knowledgeId
|
||||
} = route as any
|
||||
|
||||
const { problem } = useStore()
|
||||
const { problem, paragraph } = useStore()
|
||||
const inputRef = ref()
|
||||
const loading = ref(false)
|
||||
const isAddProblem = ref(false)
|
||||
|
|
@ -96,7 +96,7 @@ watch(
|
|||
|
||||
function delProblemHandle(item: any, index: number) {
|
||||
if (item.id) {
|
||||
problem
|
||||
paragraph
|
||||
.asyncDisassociationProblem(
|
||||
props.knowledgeId || id,
|
||||
documentId || props.docId,
|
||||
|
|
@ -134,7 +134,7 @@ function addProblem() {
|
|||
function addProblemHandle(val: string) {
|
||||
if (props.problemId) {
|
||||
const api = problemOptions.value.some((option) => option.id === val)
|
||||
? problem.asyncAssociationProblem(
|
||||
? paragraph.asyncAssociationProblem(
|
||||
props.knowledgeId || id,
|
||||
documentId || props.docId,
|
||||
props.problemId,
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ const {
|
|||
params: { id }
|
||||
} = route
|
||||
|
||||
const { problem } = useStore()
|
||||
const { paragraph } = useStore()
|
||||
const RelateProblemDialogRef = ref()
|
||||
const ParagraphDialogRef = ref()
|
||||
const loading = ref(false)
|
||||
|
|
@ -127,9 +127,9 @@ const visible = ref(false)
|
|||
const paragraphList = ref<any[]>([])
|
||||
|
||||
function disassociation(item: any) {
|
||||
problem
|
||||
paragraph
|
||||
.asyncDisassociationProblem(
|
||||
item.dataset_id,
|
||||
item.knowledge_id,
|
||||
item.document_id,
|
||||
item.id,
|
||||
props.currentId,
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ import paragraphApi from '@/api/shared/paragraph'
|
|||
import useStore from '@/stores/modules-shared-system'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
const { problem, document } = useStore()
|
||||
const { problem, document, paragraph } = useStore()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
|
|
@ -173,7 +173,7 @@ function associationClick(item: any) {
|
|||
}
|
||||
} else {
|
||||
if (isAssociation(item.id)) {
|
||||
problem
|
||||
paragraph
|
||||
.asyncDisassociationProblem(
|
||||
id,
|
||||
item.document_id,
|
||||
|
|
@ -185,7 +185,7 @@ function associationClick(item: any) {
|
|||
getRecord(currentProblemId.value)
|
||||
})
|
||||
} else {
|
||||
problem
|
||||
paragraph
|
||||
.asyncAssociationProblem(
|
||||
id,
|
||||
item.document_id,
|
||||
|
|
|
|||
|
|
@ -109,17 +109,17 @@ const props = withDefaults(
|
|||
|
||||
next_disable: boolean
|
||||
}>(),
|
||||
{}
|
||||
{},
|
||||
)
|
||||
|
||||
const emit = defineEmits(['update:currentId', 'update:currentContent', 'refresh'])
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const { problem } = useStore()
|
||||
const { paragraph } = useStore()
|
||||
const RelateProblemDialogRef = ref()
|
||||
const ParagraphDialogRef = ref()
|
||||
const loading = ref(false)
|
||||
|
|
@ -127,13 +127,13 @@ const visible = ref(false)
|
|||
const paragraphList = ref<any[]>([])
|
||||
|
||||
function disassociation(item: any) {
|
||||
problem
|
||||
paragraph
|
||||
.asyncDisassociationProblem(
|
||||
item.dataset_id,
|
||||
item.knowledge_id,
|
||||
item.document_id,
|
||||
item.id,
|
||||
props.currentId,
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
.then(() => {
|
||||
getRecord()
|
||||
|
|
@ -151,7 +151,7 @@ function editParagraph(row: any) {
|
|||
function editName(val: string) {
|
||||
if (val) {
|
||||
const obj = {
|
||||
content: val
|
||||
content: val,
|
||||
}
|
||||
problemApi.putProblems(id as string, props.currentId, obj, loading).then(() => {
|
||||
emit('update:currentContent', val)
|
||||
|
|
@ -183,7 +183,7 @@ watch(
|
|||
() => {
|
||||
paragraphList.value = []
|
||||
getRecord()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
watch(visible, (bool) => {
|
||||
|
|
@ -200,7 +200,7 @@ const open = () => {
|
|||
}
|
||||
|
||||
defineExpose({
|
||||
open
|
||||
open,
|
||||
})
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ import paragraphApi from '@/api/knowledge/paragraph'
|
|||
import useStore from '@/stores'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
const { problem, document } = useStore()
|
||||
const { problem, document, paragraph } = useStore()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
|
|
@ -173,7 +173,7 @@ function associationClick(item: any) {
|
|||
}
|
||||
} else {
|
||||
if (isAssociation(item.id)) {
|
||||
problem
|
||||
paragraph
|
||||
.asyncDisassociationProblem(
|
||||
id,
|
||||
item.document_id,
|
||||
|
|
@ -185,7 +185,7 @@ function associationClick(item: any) {
|
|||
getRecord(currentProblemId.value)
|
||||
})
|
||||
} else {
|
||||
problem
|
||||
paragraph
|
||||
.asyncAssociationProblem(
|
||||
id,
|
||||
item.document_id,
|
||||
|
|
|
|||
|
|
@ -1,119 +0,0 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:close-on-press-escape="false"
|
||||
:close-on-click-modal="false"
|
||||
:destroy-on-close="true"
|
||||
width="600"
|
||||
class="member-dialog"
|
||||
>
|
||||
<template #header="{ titleId, titleClass }">
|
||||
<h4 :id="titleId" :class="titleClass">{{ $t('views.team.addMember') }}</h4>
|
||||
<div class="dialog-sub-title">{{ $t('views.team.addSubTitle') }}</div>
|
||||
</template>
|
||||
|
||||
<el-form
|
||||
ref="addMemberFormRef"
|
||||
:model="memberForm"
|
||||
label-position="top"
|
||||
:rules="rules"
|
||||
require-asterisk-position="right"
|
||||
@submit.prevent
|
||||
>
|
||||
<el-form-item :label="$t('views.team.teamForm.form.userName.label')" prop="users">
|
||||
<tags-input
|
||||
v-model:tags="memberForm.users"
|
||||
:placeholder="$t('views.team.teamForm.form.userName.placeholder')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }} </el-button>
|
||||
<el-button type="primary" @click="submitMember(addMemberFormRef)" :loading="loading">
|
||||
{{ $t('common.add') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import AuthorizationApi from '@/api/user/resource-authorization'
|
||||
import { t } from '@/locales'
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
||||
const memberForm = ref({
|
||||
users: [],
|
||||
})
|
||||
|
||||
const addMemberFormRef = ref<FormInstance>()
|
||||
|
||||
const loading = ref<boolean>(false)
|
||||
|
||||
const rules = ref<FormRules>({
|
||||
users: [
|
||||
{
|
||||
type: 'array',
|
||||
required: true,
|
||||
message: t('views.team.teamForm.form.userName.requiredMessage'),
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
memberForm.value = {
|
||||
users: [],
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
const submitMember = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
const idsArray = memberForm.value.users.map((obj: any) => obj.id)
|
||||
AuthorizationApi.postCreatTeamMember(idsArray, loading).then((res) => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
emit('refresh', idsArray)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
defineExpose({ open, close })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.member-dialog {
|
||||
.el-dialog__header {
|
||||
padding-bottom: 19px;
|
||||
}
|
||||
}
|
||||
.custom-select-multiple {
|
||||
width: 200%;
|
||||
.el-input {
|
||||
min-height: 100px;
|
||||
}
|
||||
.el-select__tags {
|
||||
top: 0;
|
||||
transform: none;
|
||||
padding-top: 8px;
|
||||
}
|
||||
.el-input__wrapper {
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -21,12 +21,10 @@
|
|||
<img :src="row?.icon" alt="" />
|
||||
</el-avatar>
|
||||
|
||||
<el-avatar
|
||||
v-else-if="row?.name && isApplication"
|
||||
:name="row?.name"
|
||||
pinyinColor
|
||||
shape="square"
|
||||
:size="20"
|
||||
<LogoIcon
|
||||
v-else-if="isApplication"
|
||||
height="28px"
|
||||
style="width: 28px; height: 28px; display: block"
|
||||
class="mr-12"
|
||||
/>
|
||||
<el-avatar
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@
|
|||
<h4>{{ $t('views.role.member.add') }}</h4>
|
||||
</template>
|
||||
<template #default>
|
||||
<MemberFormContent ref="memberFormContentRef" :models="formItemModel" v-model:form="list"
|
||||
v-loading="memberFormContentLoading" />
|
||||
<MemberFormContent
|
||||
ref="memberFormContentRef"
|
||||
:models="formItemModel"
|
||||
v-model:form="list"
|
||||
v-loading="memberFormContentLoading"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div style="flex: auto">
|
||||
|
|
@ -35,65 +39,71 @@ const props = defineProps<{
|
|||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'refresh'): void;
|
||||
}>();
|
||||
(e: 'refresh'): void
|
||||
}>()
|
||||
|
||||
const loading = ref(false)
|
||||
const visible = ref(false)
|
||||
const list = ref<CreateMemberParamsItem[]>([]);
|
||||
const list = ref<CreateMemberParamsItem[]>([])
|
||||
|
||||
const memberFormContentLoading = ref(false);
|
||||
const formItemModel = ref<FormItemModel[]>([]);
|
||||
const userFormItem = ref<FormItemModel[]>([]);
|
||||
const workspaceFormItem = ref<FormItemModel[]>([]);
|
||||
const memberFormContentLoading = ref(false)
|
||||
const formItemModel = ref<FormItemModel[]>([])
|
||||
const userFormItem = ref<FormItemModel[]>([])
|
||||
const workspaceFormItem = ref<FormItemModel[]>([])
|
||||
|
||||
async function getUserFormItem() {
|
||||
try {
|
||||
const res = await UserApi.getUserList(memberFormContentLoading);
|
||||
userFormItem.value = [{
|
||||
path: 'user_ids',
|
||||
label: t('views.role.member.title'),
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: `${t('common.selectPlaceholder')}${t('views.role.member.title')}`,
|
||||
const res = await UserApi.getUserList(memberFormContentLoading)
|
||||
userFormItem.value = [
|
||||
{
|
||||
path: 'user_ids',
|
||||
label: t('views.role.member.title'),
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: `${t('common.selectPlaceholder')}${t('views.role.member.title')}`,
|
||||
},
|
||||
],
|
||||
selectProps: {
|
||||
options:
|
||||
res.data?.map((item) => ({
|
||||
label: item.nick_name,
|
||||
value: item.id,
|
||||
})) || [],
|
||||
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.title')}`,
|
||||
},
|
||||
],
|
||||
selectProps: {
|
||||
options: res.data?.map(item => ({
|
||||
label: item.nick_name,
|
||||
value: item.id
|
||||
})) || [],
|
||||
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.title')}`
|
||||
}
|
||||
}];
|
||||
},
|
||||
]
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
async function getWorkspaceFormItem() {
|
||||
try {
|
||||
const res = await WorkspaceApi.getWorkspaceList(memberFormContentLoading);
|
||||
workspaceFormItem.value = [{
|
||||
path: 'workspace_ids',
|
||||
label: t('views.role.member.workspace'),
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`,
|
||||
const res = await WorkspaceApi.getWorkspaceList(memberFormContentLoading)
|
||||
workspaceFormItem.value = [
|
||||
{
|
||||
path: 'workspace_ids',
|
||||
label: t('views.role.member.workspace'),
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`,
|
||||
},
|
||||
],
|
||||
selectProps: {
|
||||
options:
|
||||
res.data?.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})) || [],
|
||||
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`,
|
||||
},
|
||||
],
|
||||
selectProps: {
|
||||
options: res.data?.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id
|
||||
})) || [],
|
||||
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`
|
||||
}
|
||||
}]
|
||||
},
|
||||
]
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,13 +118,13 @@ function init() {
|
|||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
await getUserFormItem();
|
||||
await getWorkspaceFormItem();
|
||||
await getUserFormItem()
|
||||
await getWorkspaceFormItem()
|
||||
init()
|
||||
})
|
||||
|
||||
function open() {
|
||||
init();
|
||||
init()
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
|
|
@ -124,19 +134,23 @@ function handleCancel() {
|
|||
|
||||
const memberFormContentRef = ref<InstanceType<typeof MemberFormContent>>()
|
||||
function handleAdd() {
|
||||
memberFormContentRef.value?.validate().then(async (valid) => {
|
||||
memberFormContentRef.value?.validate().then(async (valid: any) => {
|
||||
if (valid) {
|
||||
let params;
|
||||
let params
|
||||
if (props.currentRole?.type === RoleTypeEnum.ADMIN) {
|
||||
params = list.value.map(item => ({ user_ids: item.user_ids, workspace_ids: ['None'] }))
|
||||
params = list.value.map((item) => ({ user_ids: item.user_ids, workspace_ids: ['None'] }))
|
||||
}
|
||||
await RoleApi.CreateMember(props.currentRole?.id as string, { members: params ?? list.value }, loading)
|
||||
await RoleApi.CreateMember(
|
||||
props.currentRole?.id as string,
|
||||
{ members: params ?? list.value },
|
||||
loading,
|
||||
)
|
||||
MsgSuccess(t('common.addSuccess'))
|
||||
handleCancel();
|
||||
handleCancel()
|
||||
emit('refresh')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -81,16 +81,16 @@ const submitMember = async (formEl: FormInstance | undefined) => {
|
|||
if (valid) {
|
||||
loading.value = true
|
||||
let idsArray = memberForm.value.users.map((obj: any) => obj.id)
|
||||
TeamApi.postCreatTeamMember(idsArray)
|
||||
.then((res) => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
emit('refresh', idsArray)
|
||||
dialogVisible.value = false
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
// GroupApi.postCreatTeamMember(idsArray)
|
||||
// .then((res) => {
|
||||
// MsgSuccess(t('common.submitSuccess'))
|
||||
// emit('refresh', idsArray)
|
||||
// dialogVisible.value = false
|
||||
// loading.value = false
|
||||
// })
|
||||
// .catch(() => {
|
||||
// loading.value = false
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click.prevent="deleteMember(row)">{{
|
||||
<!-- <el-dropdown-item @click.prevent="deleteMember(row)">{{
|
||||
$t('views.system.group.delete.button')
|
||||
}}</el-dropdown-item>
|
||||
}}</el-dropdown-item> -->
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
|
@ -82,9 +82,9 @@ const tableHeight = ref(0)
|
|||
|
||||
watch(filterText, (val) => {
|
||||
if (val) {
|
||||
filterGroup.value = groupList.value.filter((v) =>
|
||||
v.name.toLowerCase().includes(val.toLowerCase()),
|
||||
)
|
||||
// filterGroup.value = groupList.value.filter((v) =>
|
||||
// v.name.toLowerCase().includes(val.toLowerCase()),
|
||||
// )
|
||||
} else {
|
||||
filterGroup.value = groupList.value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,15 +117,15 @@ function handleCancel() {
|
|||
|
||||
const memberFormContentRef = ref<InstanceType<typeof MemberFormContent>>()
|
||||
function handleAdd() {
|
||||
memberFormContentRef.value?.validate().then(async (valid) => {
|
||||
if (valid) {
|
||||
await WorkspaceApi.CreateWorkspaceMember(props.currentWorkspace?.id as string, list.value, loading)
|
||||
MsgSuccess(t('common.addSuccess'))
|
||||
handleCancel();
|
||||
emit('refresh')
|
||||
}
|
||||
})
|
||||
// memberFormContentRef.value?.validate().then(async (valid) => {
|
||||
// if (valid) {
|
||||
// await WorkspaceApi.CreateWorkspaceMember(props.currentWorkspace?.id as string, list.value, loading)
|
||||
// MsgSuccess(t('common.addSuccess'))
|
||||
// handleCancel();
|
||||
// emit('refresh')
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -90,29 +90,29 @@ export const aiChatNode = {
|
|||
/**
|
||||
* 知识库检索配置数据
|
||||
*/
|
||||
export const searchDatasetNode = {
|
||||
type: WorkflowType.SearchDataset,
|
||||
text: t('views.applicationWorkflow.nodes.searchDatasetNode.text'),
|
||||
label: t('views.applicationWorkflow.nodes.searchDatasetNode.label'),
|
||||
export const searchKnowledgeNode = {
|
||||
type: WorkflowType.SearchKnowledge,
|
||||
text: t('views.applicationWorkflow.nodes.searchKnowledgeNode.text'),
|
||||
label: t('views.applicationWorkflow.nodes.searchKnowledgeNode.label'),
|
||||
height: 355,
|
||||
properties: {
|
||||
stepName: t('views.applicationWorkflow.nodes.searchDatasetNode.label'),
|
||||
stepName: t('views.applicationWorkflow.nodes.searchKnowledgeNode.label'),
|
||||
config: {
|
||||
fields: [
|
||||
{
|
||||
label: t('views.applicationWorkflow.nodes.searchDatasetNode.paragraph_list'),
|
||||
label: t('views.applicationWorkflow.nodes.searchKnowledgeNode.paragraph_list'),
|
||||
value: 'paragraph_list'
|
||||
},
|
||||
{
|
||||
label: t('views.applicationWorkflow.nodes.searchDatasetNode.is_hit_handling_method_list'),
|
||||
label: t('views.applicationWorkflow.nodes.searchKnowledgeNode.is_hit_handling_method_list'),
|
||||
value: 'is_hit_handling_method_list'
|
||||
},
|
||||
{
|
||||
label: t('views.applicationWorkflow.nodes.searchDatasetNode.result'),
|
||||
label: t('views.applicationWorkflow.nodes.searchKnowledgeNode.result'),
|
||||
value: 'data'
|
||||
},
|
||||
{
|
||||
label: t('views.applicationWorkflow.nodes.searchDatasetNode.directly_return'),
|
||||
label: t('views.applicationWorkflow.nodes.searchKnowledgeNode.directly_return'),
|
||||
value: 'directly_return'
|
||||
}
|
||||
]
|
||||
|
|
@ -341,7 +341,7 @@ export const menuNodes = [
|
|||
aiChatNode,
|
||||
imageUnderstandNode,
|
||||
imageGenerateNode,
|
||||
searchDatasetNode,
|
||||
searchKnowledgeNode,
|
||||
rerankerNode,
|
||||
conditionNode,
|
||||
replyNode,
|
||||
|
|
@ -431,7 +431,7 @@ export const compareList = [
|
|||
|
||||
export const nodeDict: any = {
|
||||
[WorkflowType.AiChat]: aiChatNode,
|
||||
[WorkflowType.SearchDataset]: searchDatasetNode,
|
||||
[WorkflowType.SearchKnowledge]: searchKnowledgeNode,
|
||||
[WorkflowType.Question]: questionNode,
|
||||
[WorkflowType.Condition]: conditionNode,
|
||||
[WorkflowType.Base]: baseNode,
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ const {
|
|||
|
||||
// @ts-ignore
|
||||
const defaultPrompt = `${t('views.applicationWorkflow.nodes.aiChatNode.defaultPrompt')}:
|
||||
{{${t('views.applicationWorkflow.nodes.searchDatasetNode.label')}.data}}
|
||||
{{${t('views.applicationWorkflow.nodes.searchKnowledgeNode.label')}.data}}
|
||||
${t('views.problem.title')}:
|
||||
{{${t('views.applicationWorkflow.nodes.startNode.label')}.question}}`
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
prop="question_reference_address"
|
||||
:rules="{
|
||||
message: $t(
|
||||
'views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.requiredMessage'
|
||||
'views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.requiredMessage'
|
||||
),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.placeholder')
|
||||
$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.placeholder')
|
||||
"
|
||||
v-model="form_data.question_reference_address"
|
||||
/>
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.placeholder')
|
||||
$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.placeholder')
|
||||
"
|
||||
v-model="form_data.api_input_field_list[index].value"
|
||||
/>
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.placeholder')
|
||||
$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.placeholder')
|
||||
"
|
||||
v-model="form_data.user_input_field_list[index].value"
|
||||
/>
|
||||
|
|
@ -221,83 +221,84 @@ const update_field = () => {
|
|||
set(props.nodeModel.properties, 'status', 500)
|
||||
return
|
||||
}
|
||||
applicationApi
|
||||
.getApplicationById(id, props.nodeModel.properties.node_data.application_id)
|
||||
.then((ok) => {
|
||||
const old_api_input_field_list = cloneDeep(
|
||||
props.nodeModel.properties.node_data.api_input_field_list
|
||||
)
|
||||
const old_user_input_field_list = cloneDeep(
|
||||
props.nodeModel.properties.node_data.user_input_field_list
|
||||
)
|
||||
if (isWorkFlow(ok.data.type)) {
|
||||
const nodeData = ok.data.work_flow.nodes[0].properties.node_data
|
||||
const new_api_input_field_list = cloneDeep(
|
||||
ok.data.work_flow.nodes[0].properties.api_input_field_list
|
||||
)
|
||||
const new_user_input_field_list = cloneDeep(
|
||||
ok.data.work_flow.nodes[0].properties.user_input_field_list
|
||||
)
|
||||
// todo
|
||||
// applicationApi
|
||||
// .getApplicationById(id, props.nodeModel.properties.node_data.application_id)
|
||||
// .then((ok) => {
|
||||
// const old_api_input_field_list = cloneDeep(
|
||||
// props.nodeModel.properties.node_data.api_input_field_list
|
||||
// )
|
||||
// const old_user_input_field_list = cloneDeep(
|
||||
// props.nodeModel.properties.node_data.user_input_field_list
|
||||
// )
|
||||
// if (isWorkFlow(ok.data.type)) {
|
||||
// const nodeData = ok.data.work_flow.nodes[0].properties.node_data
|
||||
// const new_api_input_field_list = cloneDeep(
|
||||
// ok.data.work_flow.nodes[0].properties.api_input_field_list
|
||||
// )
|
||||
// const new_user_input_field_list = cloneDeep(
|
||||
// ok.data.work_flow.nodes[0].properties.user_input_field_list
|
||||
// )
|
||||
|
||||
const merge_api_input_field_list = (new_api_input_field_list || []).map((item: any) => {
|
||||
const find_field = old_api_input_field_list.find(
|
||||
(old_item: any) => old_item.variable == item.variable
|
||||
)
|
||||
if (find_field) {
|
||||
return {
|
||||
...item,
|
||||
value: find_field.value,
|
||||
label:
|
||||
typeof item.label === 'object' && item.label != null ? item.label.label : item.label
|
||||
}
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
set(
|
||||
props.nodeModel.properties.node_data,
|
||||
'api_input_field_list',
|
||||
merge_api_input_field_list
|
||||
)
|
||||
const merge_user_input_field_list = (new_user_input_field_list || []).map((item: any) => {
|
||||
const find_field = old_user_input_field_list.find(
|
||||
(old_item: any) => old_item.field == item.field
|
||||
)
|
||||
if (find_field) {
|
||||
return {
|
||||
...item,
|
||||
value: find_field.value,
|
||||
label:
|
||||
typeof item.label === 'object' && item.label != null ? item.label.label : item.label
|
||||
}
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
set(
|
||||
props.nodeModel.properties.node_data,
|
||||
'user_input_field_list',
|
||||
merge_user_input_field_list
|
||||
)
|
||||
const fileEnable = nodeData.file_upload_enable
|
||||
const fileUploadSetting = nodeData.file_upload_setting
|
||||
if (fileEnable) {
|
||||
handleFileUpload('document', fileUploadSetting.document)
|
||||
handleFileUpload('image', fileUploadSetting.image)
|
||||
handleFileUpload('audio', fileUploadSetting.audio)
|
||||
} else {
|
||||
;['document_list', 'image_list', 'audio_list'].forEach((list) => {
|
||||
// eslint-disable-next-line vue/no-mutating-props
|
||||
delete props.nodeModel.properties.node_data[list]
|
||||
})
|
||||
}
|
||||
set(props.nodeModel.properties, 'status', ok.data.id ? 200 : 500)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
set(props.nodeModel.properties, 'status', 500)
|
||||
})
|
||||
// const merge_api_input_field_list = (new_api_input_field_list || []).map((item: any) => {
|
||||
// const find_field = old_api_input_field_list.find(
|
||||
// (old_item: any) => old_item.variable == item.variable
|
||||
// )
|
||||
// if (find_field) {
|
||||
// return {
|
||||
// ...item,
|
||||
// value: find_field.value,
|
||||
// label:
|
||||
// typeof item.label === 'object' && item.label != null ? item.label.label : item.label
|
||||
// }
|
||||
// } else {
|
||||
// return item
|
||||
// }
|
||||
// })
|
||||
// set(
|
||||
// props.nodeModel.properties.node_data,
|
||||
// 'api_input_field_list',
|
||||
// merge_api_input_field_list
|
||||
// )
|
||||
// const merge_user_input_field_list = (new_user_input_field_list || []).map((item: any) => {
|
||||
// const find_field = old_user_input_field_list.find(
|
||||
// (old_item: any) => old_item.field == item.field
|
||||
// )
|
||||
// if (find_field) {
|
||||
// return {
|
||||
// ...item,
|
||||
// value: find_field.value,
|
||||
// label:
|
||||
// typeof item.label === 'object' && item.label != null ? item.label.label : item.label
|
||||
// }
|
||||
// } else {
|
||||
// return item
|
||||
// }
|
||||
// })
|
||||
// set(
|
||||
// props.nodeModel.properties.node_data,
|
||||
// 'user_input_field_list',
|
||||
// merge_user_input_field_list
|
||||
// )
|
||||
// const fileEnable = nodeData.file_upload_enable
|
||||
// const fileUploadSetting = nodeData.file_upload_setting
|
||||
// if (fileEnable) {
|
||||
// handleFileUpload('document', fileUploadSetting.document)
|
||||
// handleFileUpload('image', fileUploadSetting.image)
|
||||
// handleFileUpload('audio', fileUploadSetting.audio)
|
||||
// } else {
|
||||
// ;['document_list', 'image_list', 'audio_list'].forEach((list) => {
|
||||
// // eslint-disable-next-line vue/no-mutating-props
|
||||
// delete props.nodeModel.properties.node_data[list]
|
||||
// })
|
||||
// }
|
||||
// set(props.nodeModel.properties, 'status', ok.data.id ? 200 : 500)
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.log(err)
|
||||
// set(props.nodeModel.properties, 'status', 500)
|
||||
// })
|
||||
}
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
label-width="auto"
|
||||
ref="DatasetNodeFormRef"
|
||||
>
|
||||
<el-form-item :label="$t('views.problem.relateParagraph.selectDocument')" :rules="{
|
||||
type: 'array',
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
import FunctionLibNodeVue from './index.vue'
|
||||
import { AppNode, AppNodeModel } from '@/workflow/common/app-node'
|
||||
class FunctionLibNode extends AppNode {
|
||||
constructor(props: any) {
|
||||
super(props, FunctionLibNodeVue)
|
||||
}
|
||||
}
|
||||
export default {
|
||||
type: 'function-lib-node',
|
||||
model: AppNodeModel,
|
||||
view: FunctionLibNode
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
:rules="{
|
||||
required: true,
|
||||
message: $t('views.applicationWorkflow.nodes.imageGenerateNode.model.requiredMessage'),
|
||||
trigger: 'change'
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
:rules="{
|
||||
required: true,
|
||||
message: $t('views.application.form.prompt.requiredMessage'),
|
||||
trigger: 'blur'
|
||||
trigger: 'blur',
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
:rules="{
|
||||
required: false,
|
||||
message: $t('views.application.form.prompt.requiredMessage'),
|
||||
trigger: 'blur'
|
||||
trigger: 'blur',
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -131,10 +131,9 @@
|
|||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<div class="mr-4">
|
||||
<span
|
||||
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
|
||||
}}</span
|
||||
>
|
||||
<span>{{
|
||||
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
|
||||
}}</span>
|
||||
</div>
|
||||
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
|
||||
<template #content>
|
||||
|
|
@ -165,7 +164,7 @@ import { t } from '@/locales'
|
|||
const { model } = useStore()
|
||||
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = app.config.globalProperties.$route as any
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
|
@ -201,7 +200,7 @@ const form = {
|
|||
is_result: true,
|
||||
temperature: null,
|
||||
max_tokens: null,
|
||||
image_list: ['start-node', 'image']
|
||||
image_list: ['start-node', 'image'],
|
||||
}
|
||||
|
||||
const form_data = computed({
|
||||
|
|
@ -215,14 +214,15 @@ const form_data = computed({
|
|||
},
|
||||
set: (value) => {
|
||||
set(props.nodeModel.properties, 'node_data', value)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
function getModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationTTIModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
// todo
|
||||
// applicationApi.getApplicationTTIModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
|
|
|
|||
|
|
@ -242,9 +242,10 @@ const form_data = computed({
|
|||
|
||||
function getModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationImageModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
//todo
|
||||
// applicationApi.getApplicationImageModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
|
|
|
|||
|
|
@ -261,16 +261,17 @@ function getTools() {
|
|||
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
|
||||
return
|
||||
}
|
||||
applicationApi
|
||||
.getMcpTools({ mcp_servers: form_data.value.mcp_servers }, loading)
|
||||
.then((res: any) => {
|
||||
form_data.value.mcp_tools = res.data
|
||||
MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
|
||||
// 修改了json,刷新mcp_server
|
||||
form_data.value.mcp_server = form_data.value.mcp_tools.filter(
|
||||
(item: any) => item.name === form_data.value.mcp_tool
|
||||
)[0].server
|
||||
})
|
||||
// todo
|
||||
// applicationApi
|
||||
// .getMcpTools({ mcp_servers: form_data.value.mcp_servers }, loading)
|
||||
// .then((res: any) => {
|
||||
// form_data.value.mcp_tools = res.data
|
||||
// MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
|
||||
// // 修改了json,刷新mcp_server
|
||||
// form_data.value.mcp_server = form_data.value.mcp_tools.filter(
|
||||
// (item: any) => item.name === form_data.value.mcp_tool
|
||||
// )[0].server
|
||||
// })
|
||||
}
|
||||
|
||||
function changeTool() {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
:rules="{
|
||||
required: true,
|
||||
message: $t('views.application.form.aiModel.placeholder'),
|
||||
trigger: 'change'
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
:rules="{
|
||||
required: true,
|
||||
message: $t('views.application.form.prompt.tooltip'),
|
||||
trigger: 'blur'
|
||||
trigger: 'blur',
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -79,9 +79,7 @@
|
|||
>
|
||||
</div>
|
||||
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
|
||||
<template #content>{{
|
||||
$t('views.application.form.prompt.tooltip')
|
||||
}}</template>
|
||||
<template #content>{{ $t('views.application.form.prompt.tooltip') }}</template>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
</el-tooltip>
|
||||
|
|
@ -113,10 +111,9 @@
|
|||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<div class="mr-4">
|
||||
<span
|
||||
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
|
||||
}}</span
|
||||
>
|
||||
<span>{{
|
||||
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
|
||||
}}</span>
|
||||
</div>
|
||||
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
|
||||
<template #content>
|
||||
|
|
@ -173,7 +170,7 @@ function submitSystemDialog(val: string) {
|
|||
set(props.nodeModel.properties.node_data, 'system', val)
|
||||
}
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = app.config.globalProperties.$route as any
|
||||
|
||||
// @ts-ignore
|
||||
|
|
@ -185,7 +182,7 @@ const form = {
|
|||
system: t('views.applicationWorkflow.nodes.questionNode.systemDefault'),
|
||||
prompt: defaultPrompt,
|
||||
dialogue_number: 1,
|
||||
is_result: false
|
||||
is_result: false,
|
||||
}
|
||||
function refreshParam(data: any) {
|
||||
set(props.nodeModel.properties.node_data, 'model_params_setting', data)
|
||||
|
|
@ -207,7 +204,7 @@ const form_data = computed({
|
|||
},
|
||||
set: (value) => {
|
||||
set(props.nodeModel.properties, 'node_data', value)
|
||||
}
|
||||
},
|
||||
})
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
|
|
@ -223,9 +220,10 @@ const validate = () => {
|
|||
|
||||
function getModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
//todo
|
||||
// applicationApi.getApplicationModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.placeholder')
|
||||
$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.placeholder')
|
||||
"
|
||||
v-model="form_data.fields"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
:rules="{
|
||||
type: 'array',
|
||||
message: $t(
|
||||
'views.applicationWorkflow.nodes.rerankerNode.rerankerContent.requiredMessage'
|
||||
'views.applicationWorkflow.nodes.rerankerNode.rerankerContent.requiredMessage',
|
||||
),
|
||||
trigger: 'change',
|
||||
required: true
|
||||
required: true,
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
type: 'array',
|
||||
required: true,
|
||||
message: $t('views.applicationWorkflow.variable.placeholder'),
|
||||
trigger: 'change'
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<NodeCascader
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
class="w-full"
|
||||
:placeholder="
|
||||
$t(
|
||||
'views.applicationWorkflow.nodes.rerankerNode.rerankerContent.requiredMessage'
|
||||
'views.applicationWorkflow.nodes.rerankerNode.rerankerContent.requiredMessage',
|
||||
)
|
||||
"
|
||||
v-model="form_data.reranker_reference_list[index]"
|
||||
|
|
@ -69,10 +69,10 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('views.applicationWorkflow.nodes.searchDatasetNode.searchParam')">
|
||||
<el-form-item :label="$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchParam')">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>{{ $t('views.applicationWorkflow.nodes.searchDatasetNode.searchParam') }}</span>
|
||||
<span>{{ $t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchParam') }}</span>
|
||||
<el-button type="primary" link @click="openParamSettingDialog">
|
||||
<el-icon><Setting /></el-icon>
|
||||
</el-button>
|
||||
|
|
@ -103,20 +103,20 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.label')"
|
||||
:label="$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.label')"
|
||||
prop="question_reference_address"
|
||||
:rules="{
|
||||
message: $t(
|
||||
'views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.requiredMessage'
|
||||
'views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.requiredMessage',
|
||||
),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
required: true,
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span
|
||||
>{{ $t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.label')
|
||||
>{{ $t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.label')
|
||||
}}<span class="danger">*</span></span
|
||||
>
|
||||
</div>
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.label')
|
||||
$t('views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.label')
|
||||
"
|
||||
v-model="form_data.question_reference_address"
|
||||
/>
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
:rules="{
|
||||
required: true,
|
||||
message: $t('views.applicationWorkflow.nodes.rerankerNode.reranker_model.placeholder'),
|
||||
trigger: 'change'
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<template #label>
|
||||
|
|
@ -182,7 +182,7 @@ const props = defineProps<{ nodeModel: any }>()
|
|||
|
||||
const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = app.config.globalProperties.$route as any
|
||||
const form = {
|
||||
reranker_reference_list: [[]],
|
||||
|
|
@ -191,8 +191,8 @@ const form = {
|
|||
reranker_setting: {
|
||||
top_n: 3,
|
||||
similarity: 0,
|
||||
max_paragraph_char_number: 5000
|
||||
}
|
||||
max_paragraph_char_number: 5000,
|
||||
},
|
||||
}
|
||||
|
||||
const modelOptions = ref<any>(null)
|
||||
|
|
@ -224,16 +224,17 @@ const form_data = computed({
|
|||
},
|
||||
set: (value) => {
|
||||
set(props.nodeModel.properties, 'node_data', value)
|
||||
}
|
||||
},
|
||||
})
|
||||
function refreshParam(data: any) {
|
||||
set(props.nodeModel.properties.node_data, 'reranker_setting', data)
|
||||
}
|
||||
function getModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationRerankerModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
//todo
|
||||
// applicationApi.getApplicationRerankerModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
} else {
|
||||
model.asyncGetModel({ model_type: 'RERANKER' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
|
|
@ -251,7 +252,7 @@ const nodeCascaderRef = ref()
|
|||
const validate = () => {
|
||||
return Promise.all([
|
||||
nodeCascaderRef.value ? nodeCascaderRef.value.validate() : Promise.resolve(''),
|
||||
rerankerNodeFormRef.value?.validate()
|
||||
rerankerNodeFormRef.value?.validate(),
|
||||
]).catch((err: any) => {
|
||||
return Promise.reject({ node: props.nodeModel, errMessage: err })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,41 +8,41 @@
|
|||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
label-width="auto"
|
||||
ref="DatasetNodeFormRef"
|
||||
ref="knowledgeNodeFormRef"
|
||||
>
|
||||
<el-form-item :label="$t('views.chatLog.selectKnowledge')">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>{{ $t('views.chatLog.selectKnowledge') }}</span>
|
||||
<el-button type="primary" link @click="openDatasetDialog">
|
||||
<el-button type="primary" link @click="openknowledgeDialog">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full">
|
||||
<el-text type="info" v-if="form_data.dataset_id_list?.length === 0">
|
||||
<el-text type="info" v-if="form_data.knowledge_id_list?.length === 0">
|
||||
{{ $t('views.application.form.relatedKnowledge.placeholder') }}
|
||||
</el-text>
|
||||
<template v-for="(item, index) in form_data.dataset_id_list" :key="index" v-else>
|
||||
<template v-for="(item, index) in form_data.knowledge_id_list" :key="index" v-else>
|
||||
<div class="flex-between border border-r-4 white-bg mb-4" style="padding: 5px 8px">
|
||||
<div class="flex align-center" style="line-height: 20px">
|
||||
<KnowledgeIcon :type="relatedObject(datasetList, item, 'id')?.type" />
|
||||
<KnowledgeIcon :type="relatedObject(knowledgeList, item, 'id')?.type" />
|
||||
|
||||
<div class="ellipsis" :title="relatedObject(datasetList, item, 'id')?.name">
|
||||
{{ relatedObject(datasetList, item, 'id')?.name }}
|
||||
<div class="ellipsis" :title="relatedObject(knowledgeList, item, 'id')?.name">
|
||||
{{ relatedObject(knowledgeList, item, 'id')?.name }}
|
||||
</div>
|
||||
</div>
|
||||
<el-button text @click="removeDataset(item)">
|
||||
<el-button text @click="removeknowledge(item)">
|
||||
<el-icon><Close /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('views.applicationWorkflow.nodes.searchDatasetNode.searchParam')">
|
||||
<el-form-item :label="$t('views.applicationWorkflow.nodes.searchknowledgeNode.searchParam')">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>{{ $t('views.applicationWorkflow.nodes.searchDatasetNode.searchParam') }}</span>
|
||||
<span>{{ $t('views.applicationWorkflow.nodes.searchknowledgeNode.searchParam') }}</span>
|
||||
<el-button type="primary" link @click="openParamSettingDialog">
|
||||
<el-icon><Setting /></el-icon>
|
||||
</el-button>
|
||||
|
|
@ -55,34 +55,34 @@
|
|||
}}</el-col>
|
||||
<el-col :span="12" class="lighter">
|
||||
{{
|
||||
$t(SearchMode[form_data.dataset_setting.search_mode as keyof typeof SearchMode])
|
||||
$t(SearchMode[form_data.knowledge_setting.search_mode as keyof typeof SearchMode])
|
||||
}}</el-col
|
||||
>
|
||||
<el-col :span="12" class="color-secondary lighter">
|
||||
{{ $t('views.application.dialog.similarityThreshold') }}</el-col
|
||||
>
|
||||
<el-col :span="12" class="lighter">
|
||||
{{ form_data.dataset_setting.similarity?.toFixed(3) }}</el-col
|
||||
{{ form_data.knowledge_setting.similarity?.toFixed(3) }}</el-col
|
||||
>
|
||||
<el-col :span="12" class="color-secondary lighter">{{
|
||||
$t('views.application.dialog.topReferences')
|
||||
}}</el-col>
|
||||
<el-col :span="12" class="lighter"> {{ form_data.dataset_setting.top_n }}</el-col>
|
||||
<el-col :span="12" class="lighter"> {{ form_data.knowledge_setting.top_n }}</el-col>
|
||||
<el-col :span="12" class="color-secondary lighter">
|
||||
{{ $t('views.application.dialog.maxCharacters') }}</el-col
|
||||
>
|
||||
<el-col :span="12" class="lighter">
|
||||
{{ form_data.dataset_setting.max_paragraph_char_number }}</el-col
|
||||
{{ form_data.knowledge_setting.max_paragraph_char_number }}</el-col
|
||||
>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.label')"
|
||||
:label="$t('views.applicationWorkflow.nodes.searchknowledgeNode.searchQuestion.label')"
|
||||
prop="question_reference_address"
|
||||
:rules="{
|
||||
message: $t(
|
||||
'views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.requiredMessage',
|
||||
'views.applicationWorkflow.nodes.searchknowledgeNode.searchQuestion.requiredMessage',
|
||||
),
|
||||
trigger: 'blur',
|
||||
required: true,
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDatasetNode.searchQuestion.placeholder')
|
||||
$t('views.applicationWorkflow.nodes.searchknowledgeNode.searchQuestion.placeholder')
|
||||
"
|
||||
v-model="form_data.question_reference_address"
|
||||
/>
|
||||
|
|
@ -101,12 +101,12 @@
|
|||
</el-form>
|
||||
</el-card>
|
||||
<ParamSettingDialog ref="ParamSettingDialogRef" @refresh="refreshParam" />
|
||||
<AddDatasetDialog
|
||||
ref="AddDatasetDialogRef"
|
||||
<AddknowledgeDialog
|
||||
ref="AddknowledgeDialogRef"
|
||||
@addData="addKnowledge"
|
||||
:data="datasetList"
|
||||
:data="knowledgeList"
|
||||
@refresh="refresh"
|
||||
:loading="datasetLoading"
|
||||
:loading="knowledgeLoading"
|
||||
/>
|
||||
</NodeContainer>
|
||||
</template>
|
||||
|
|
@ -115,7 +115,7 @@ import { set } from 'lodash'
|
|||
import { app } from '@/main'
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import AddDatasetDialog from '@/views/application/component/AddKnowledgeDialog.vue'
|
||||
import AddknowledgeDialog from '@/views/application/component/AddKnowledgeDialog.vue'
|
||||
import ParamSettingDialog from '@/views/application/component/ParamSettingDialog.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
|
@ -130,8 +130,8 @@ const {
|
|||
const props = defineProps<{ nodeModel: any }>()
|
||||
const nodeCascaderRef = ref()
|
||||
const form = {
|
||||
dataset_id_list: [],
|
||||
dataset_setting: {
|
||||
knowledge_id_list: [],
|
||||
knowledge_setting: {
|
||||
top_n: 3,
|
||||
similarity: 0.6,
|
||||
max_paragraph_char_number: 5000,
|
||||
|
|
@ -154,61 +154,61 @@ const form_data = computed({
|
|||
},
|
||||
})
|
||||
|
||||
const DatasetNodeFormRef = ref<FormInstance>()
|
||||
const knowledgeNodeFormRef = ref<FormInstance>()
|
||||
const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
|
||||
const AddDatasetDialogRef = ref<InstanceType<typeof AddDatasetDialog>>()
|
||||
const datasetList = ref<any>([])
|
||||
const datasetLoading = ref(false)
|
||||
const AddknowledgeDialogRef = ref<InstanceType<typeof AddknowledgeDialog>>()
|
||||
const knowledgeList = ref<any>([])
|
||||
const knowledgeLoading = ref(false)
|
||||
|
||||
function refreshParam(data: any) {
|
||||
set(props.nodeModel.properties.node_data, 'dataset_setting', data.dataset_setting)
|
||||
set(props.nodeModel.properties.node_data, 'knowledge_setting', data.knowledge_setting)
|
||||
}
|
||||
|
||||
const openParamSettingDialog = () => {
|
||||
ParamSettingDialogRef.value?.open(form_data.value, 'WORK_FLOW')
|
||||
}
|
||||
|
||||
function removeDataset(id: any) {
|
||||
const list = props.nodeModel.properties.node_data.dataset_id_list.filter((v: any) => v !== id)
|
||||
set(props.nodeModel.properties.node_data, 'dataset_id_list', list)
|
||||
function removeknowledge(id: any) {
|
||||
const list = props.nodeModel.properties.node_data.knowledge_id_list.filter((v: any) => v !== id)
|
||||
set(props.nodeModel.properties.node_data, 'knowledge_id_list', list)
|
||||
}
|
||||
|
||||
function addKnowledge(val: Array<string>) {
|
||||
set(props.nodeModel.properties.node_data, 'dataset_id_list', val)
|
||||
set(props.nodeModel.properties.node_data, 'knowledge_id_list', val)
|
||||
}
|
||||
|
||||
function openDatasetDialog() {
|
||||
if (AddDatasetDialogRef.value) {
|
||||
AddDatasetDialogRef.value.open(form_data.value.dataset_id_list)
|
||||
function openknowledgeDialog() {
|
||||
if (AddknowledgeDialogRef.value) {
|
||||
AddknowledgeDialogRef.value.open(form_data.value.knowledge_id_list)
|
||||
}
|
||||
}
|
||||
|
||||
function getDataset() {
|
||||
function getknowledge() {
|
||||
// if (id) {
|
||||
// application.asyncGetApplicationKnowledge(id, datasetLoading).then((res: any) => {
|
||||
// datasetList.value = res.data
|
||||
// application.asyncGetApplicationKnowledge(id, knowledgeLoading).then((res: any) => {
|
||||
// knowledgeList.value = res.data
|
||||
// })
|
||||
// } else {
|
||||
knowledge.asyncGetRootKnowledge(datasetLoading).then((res: any) => {
|
||||
datasetList.value = res.data?.filter((v: any) => v.user_id === user.userInfo?.id)
|
||||
knowledge.asyncGetRootKnowledge(knowledgeLoading).then((res: any) => {
|
||||
knowledgeList.value = res.data?.filter((v: any) => v.user_id === user.userInfo?.id)
|
||||
})
|
||||
// }
|
||||
}
|
||||
function refresh() {
|
||||
getDataset()
|
||||
getknowledge()
|
||||
}
|
||||
|
||||
const validate = () => {
|
||||
return Promise.all([
|
||||
nodeCascaderRef.value.validate(),
|
||||
DatasetNodeFormRef.value?.validate(),
|
||||
knowledgeNodeFormRef.value?.validate(),
|
||||
]).catch((err) => {
|
||||
return Promise.reject({ node: props.nodeModel, errMessage: err })
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDataset()
|
||||
getknowledge()
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -157,9 +157,10 @@ const form_data = computed({
|
|||
|
||||
function getModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationSTTModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
//todo
|
||||
// applicationApi.getApplicationSTTModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
|
|
|
|||
|
|
@ -169,17 +169,18 @@ const form_data = computed({
|
|||
}
|
||||
})
|
||||
|
||||
function getModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationTTSModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
}
|
||||
// todo
|
||||
// function getModel() {
|
||||
// if (id) {
|
||||
// applicationApi.getApplicationTTSModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
// } else {
|
||||
// model.asyncGetModel().then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
const openTTSParamSettingDialog = () => {
|
||||
const model_id = form_data.value.tts_model_id
|
||||
|
|
@ -194,7 +195,7 @@ const refreshTTSForm = (data: any) => {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
// getModel()
|
||||
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
import ToolLibNodeVue from './index.vue'
|
||||
import { AppNode, AppNodeModel } from '@/workflow/common/app-node'
|
||||
class ToolLibNode extends AppNode {
|
||||
constructor(props: any) {
|
||||
super(props, ToolLibNodeVue)
|
||||
}
|
||||
}
|
||||
export default {
|
||||
type: 'tool-lib-node',
|
||||
model: AppNodeModel,
|
||||
view: ToolLibNode,
|
||||
}
|
||||
|
|
@ -129,23 +129,24 @@ const update_field = () => {
|
|||
set(props.nodeModel.properties, 'status', 500)
|
||||
return
|
||||
}
|
||||
applicationApi
|
||||
.getFunctionLib(id, props.nodeModel.properties.node_data.function_lib_id)
|
||||
.then((ok) => {
|
||||
const old_input_field_list = props.nodeModel.properties.node_data.input_field_list
|
||||
const merge_input_field_list = ok.data.input_field_list.map((item: any) => {
|
||||
const find_field = old_input_field_list.find((old_item: any) => old_item.name == item.name)
|
||||
if (find_field && find_field.source == item.source) {
|
||||
return { ...item, value: JSON.parse(JSON.stringify(find_field.value)) }
|
||||
}
|
||||
return { ...item, value: item.source == 'reference' ? [] : '' }
|
||||
})
|
||||
set(props.nodeModel.properties.node_data, 'input_field_list', merge_input_field_list)
|
||||
set(props.nodeModel.properties, 'status', ok.data.is_active ? 200 : 500)
|
||||
})
|
||||
.catch((err) => {
|
||||
set(props.nodeModel.properties, 'status', 500)
|
||||
})
|
||||
//todo
|
||||
// applicationApi
|
||||
// .getFunctionLib(id, props.nodeModel.properties.node_data.function_lib_id)
|
||||
// .then((ok) => {
|
||||
// const old_input_field_list = props.nodeModel.properties.node_data.input_field_list
|
||||
// const merge_input_field_list = ok.data.input_field_list.map((item: any) => {
|
||||
// const find_field = old_input_field_list.find((old_item: any) => old_item.name == item.name)
|
||||
// if (find_field && find_field.source == item.source) {
|
||||
// return { ...item, value: JSON.parse(JSON.stringify(find_field.value)) }
|
||||
// }
|
||||
// return { ...item, value: item.source == 'reference' ? [] : '' }
|
||||
// })
|
||||
// set(props.nodeModel.properties.node_data, 'input_field_list', merge_input_field_list)
|
||||
// set(props.nodeModel.properties, 'status', ok.data.is_active ? 200 : 500)
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// set(props.nodeModel.properties, 'status', 500)
|
||||
// })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
import FunctionNodeVue from './index.vue'
|
||||
import ToolNodeVue from './index.vue'
|
||||
import { AppNode, AppNodeModel } from '@/workflow/common/app-node'
|
||||
class FunctionLibCustomNode extends AppNode {
|
||||
class ToolLibCustomNode extends AppNode {
|
||||
constructor(props: any) {
|
||||
super(props, FunctionNodeVue)
|
||||
super(props, ToolNodeVue)
|
||||
}
|
||||
}
|
||||
export default {
|
||||
type: 'function-node',
|
||||
model: AppNodeModel,
|
||||
view: FunctionLibCustomNode
|
||||
view: ToolLibCustomNode,
|
||||
}
|
||||
Loading…
Reference in New Issue