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