feat: api

This commit is contained in:
wangdan-fit2cloud 2025-06-25 16:59:42 +08:00
parent 4a90127a92
commit 6724f6e9d1
42 changed files with 327 additions and 521 deletions

View File

@ -4,17 +4,20 @@
:title="data.title || '-'"
class="paragraph-source-card cursor mb-8 paragraph-source-card-height"
:class="data.is_active ? '' : 'disabled'"
:showIcon="false"
>
<template #icon>
<el-avatar class="mr-12 avatar-light" :size="22"> {{ index + 1 + '' }}</el-avatar>
</template>
<div class="active-button primary">{{ score?.toFixed(3) || data.similarity?.toFixed(3) }}</div>
<template #description>
<el-scrollbar height="150">
<MdPreview ref="editorRef" editorId="preview-only" :modelValue="content" noImgZoomIn />
</el-scrollbar>
<template #tag>
<div class="primary">
{{ score?.toFixed(3) || data.similarity?.toFixed(3) }}
</div>
</template>
<el-scrollbar height="150">
<MdPreview ref="editorRef" editorId="preview-only" :modelValue="content" noImgZoomIn />
</el-scrollbar>
<template #footer>
<div class="footer-content flex-between">
<el-text class="flex align-center item">
@ -56,20 +59,20 @@ import { computed } from 'vue'
const props = defineProps({
data: {
type: Object,
default: () => {}
default: () => {},
},
content: {
type: String,
default: ''
default: '',
},
index: {
type: Number,
default: 0
default: 0,
},
score: {
type: Number,
default: null
}
default: null,
},
})
const isMetaObject = computed(() => typeof props.data.meta === 'object')
const parsedMeta = computed(() => {

View File

@ -206,4 +206,25 @@ export default {
])
},
},
'app-quxiaoguanlian': {
iconReader: () => {
return h('i', [
h(
'svg',
{
style: { height: '100%', width: '100%' },
viewBox: '0 0 1024 1024',
version: '1.1',
xmlns: 'http://www.w3.org/2000/svg',
},
[
h('path', {
d: 'M544 298.688a32 32 0 0 1 32-32h320c41.216 0 74.688 33.408 74.688 74.624V640c0 41.216-33.472 74.688-74.688 74.688h-85.312a32 32 0 1 1 0-64H896a10.688 10.688 0 0 0 10.688-10.688V341.312A10.688 10.688 0 0 0 896 330.688H576a32 32 0 0 1-32-32zM53.312 341.312c0-41.216 33.472-74.624 74.688-74.624h106.688a32 32 0 1 1 0 64H128a10.688 10.688 0 0 0-10.688 10.624V640c0 5.888 4.8 10.688 10.688 10.688h320a32 32 0 1 1 0 64H128A74.688 74.688 0 0 1 53.312 640V341.312zM282.432 100.416a32 32 0 0 1 43.84 11.392l426.624 725.312a32 32 0 0 1-55.168 32.448L271.104 144.256a32 32 0 0 1 11.328-43.84zM650.688 490.688a32 32 0 0 1 32-32H768a32 32 0 1 1 0 64h-85.312a32 32 0 0 1-32-32zM224 490.688a32 32 0 0 1 32-32h85.312a32 32 0 1 1 0 64H256a32 32 0 0 1-32-32z',
fill: 'currentColor',
}),
],
),
])
},
},
}

View File

@ -6,9 +6,6 @@ import useThemeStore from './modules/theme'
import useKnowledgeStore from './modules/knowledge'
import useModelStore from './modules/model'
import usePromptStore from './modules/prompt'
import useProblemStore from './modules/problem'
import useParagraphStore from './modules/paragraph'
import useDocumentStore from './modules/document'
import useApplicationStore from './modules/application'
import useChatLogStore from './modules/chat-log'
import useChatUserStore from './modules/chat-user'
@ -22,9 +19,6 @@ const useStore = () => ({
knowledge: useKnowledgeStore(),
model: useModelStore(),
prompt: usePromptStore(),
problem: useProblemStore(),
paragraph: useParagraphStore(),
document: useDocumentStore(),
application: useApplicationStore(),
chatLog: useChatLogStore(),
chatUser: useChatUserStore(),

View File

@ -1,27 +0,0 @@
import { defineStore } from 'pinia'
import { type Ref } from 'vue'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const useDocumentStore = defineStore('document', {
state: () => ({}),
actions: {
async asyncGetKnowledgeDocument(
id: string,
systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace',
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
loadSharedApi({ type: 'document', systemType })
.getDocumentList(id, loading)
.then((res: any) => {
resolve(res)
})
.catch((error: any) => {
reject(error)
})
})
},
},
})
export default useDocumentStore

View File

@ -1,11 +1,7 @@
import { defineStore } from 'pinia'
import type { knowledgeData } from '@/api/type/knowledge'
import type { UploadUserFile } from 'element-plus'
import type { pageRequest } from '@/api/type/common'
import { type Ref } from 'vue'
import useUserStore from './user'
import useFolderStore from './folder'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import knowledgeApi from '@/api/knowledge/knowledge'
export interface knowledgeStateTypes {
@ -40,31 +36,7 @@ const useKnowledgeStore = defineStore('knowledge', {
setKnowledgeList(list: any[]) {
this.knowledgeList = list
},
async asyncGetKnowledgeListPage(
page: pageRequest,
isShared: boolean | undefined,
systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace',
paramsData: any,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
const folder = useFolderStore()
const user = useUserStore()
const params = {
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
scope: systemType === 'systemShare' ? 'SHARED' : 'WORKSPACE',
...paramsData,
}
loadSharedApi({ type: 'knowledge', isShared, systemType })
.getKnowledgeListPage(page, params, loading)
.then((res: any) => {
resolve(res)
})
.catch((error: any) => {
reject(error)
})
})
},
async asyncGetFolderKnowledge(folder_id?: string, loading?: Ref<boolean>) {
return new Promise((resolve, reject) => {
const params = {

View File

@ -1,20 +1,16 @@
import { defineStore } from 'pinia'
import { type Ref } from 'vue'
import ProviderApi from '@/api/model/provider'
import ModelApi from '@/api/model/model'
import type { ListModelRequest } from '@/api/type/model'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const useModelStore = defineStore('model', {
state: () => ({}),
actions: {
async asyncGetSelectModel(
systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace',
data?: ListModelRequest,
loading?: Ref<boolean>,
) {
// 仅限在应用下拉列表使用,非共享资源
async asyncGetSelectModel(data?: ListModelRequest, loading?: Ref<boolean>) {
return new Promise((resolve, reject) => {
loadSharedApi({ type: 'model', systemType })
.getSelectModelList(data, loading)
ModelApi.getSelectModelList(data, loading)
.then((res: any) => {
resolve(res)
})

View File

@ -1,91 +0,0 @@
import { defineStore } from 'pinia'
import paragraphApi from '@/api/knowledge/paragraph'
import type { Ref } from 'vue'
const useParagraphStore = defineStore('paragraph', {
state: () => ({}),
actions: {
async asyncPutParagraph(
knowledgeId: string,
documentId: string,
paragraphId: string,
data: any,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
paragraphApi
.putParagraph(knowledgeId, documentId, paragraphId, data, loading)
.then((data) => {
resolve(data)
})
.catch((error) => {
reject(error)
})
})
},
async asyncDelParagraph(
knowledgeId: string,
documentId: string,
paragraphId: string,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
paragraphApi
.delParagraph(knowledgeId, documentId, paragraphId, loading)
.then((data) => {
resolve(data)
})
.catch((error) => {
reject(error)
})
})
},
async asyncDisassociationProblem(
knowledgeId: string,
documentId: string,
paragraphId: string,
problemId: string,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
const obj = {
paragraph_id: paragraphId,
problem_id: problemId,
}
paragraphApi
.putDisassociationProblem(knowledgeId, documentId, obj, loading)
.then((data) => {
resolve(data)
})
.catch((error) => {
reject(error)
})
})
},
async asyncAssociationProblem(
knowledgeId: string,
documentId: string,
paragraphId: string,
problemId: string,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
const obj = {
paragraph_id: paragraphId,
problem_id: problemId,
}
paragraphApi
.putAssociationProblem(knowledgeId, documentId, obj, loading)
.then((data) => {
resolve(data)
})
.catch((error) => {
reject(error)
})
})
},
},
})
export default useParagraphStore

View File

@ -1,41 +0,0 @@
import { defineStore } from 'pinia'
import { type Ref } from 'vue'
import problemApi from '@/api/knowledge/problem'
import type { pageRequest } from '@/api/type/common'
const useProblemStore = defineStore('problem', {
state: () => ({}),
actions: {
async asyncPostProblem(knowledgeId: string, data: any, loading?: Ref<boolean>) {
return new Promise((resolve, reject) => {
problemApi
.postProblems(knowledgeId, data, loading)
.then((data) => {
resolve(data)
})
.catch((error) => {
reject(error)
})
})
},
async asyncGetProblem(
knowledgeId: string,
page: pageRequest,
param: any,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
problemApi
.getProblemsPage(knowledgeId, page, param, loading)
.then((data) => {
resolve(data)
})
.catch((error) => {
reject(error)
})
})
},
},
})
export default useProblemStore

View File

@ -13,31 +13,6 @@ const useToolStore = defineStore('tool', {
setToolList(list: any[]) {
this.toolList = list
},
async asyncGetToolListPage(
page: pageRequest,
isShared: boolean | undefined,
systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace',
paramsData: any,
loading?: Ref<boolean>,
) {
return new Promise((resolve, reject) => {
const folder = useFolderStore()
const user = useUserStore()
const params = {
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
scope: systemType === 'systemShare' ? 'SHARED' : 'WORKSPACE',
...paramsData,
}
loadSharedApi({ type: 'tool', isShared, systemType })
.getToolListPage(page, params, loading)
.then((res: any) => {
resolve(res)
})
.catch((error: any) => {
reject(error)
})
})
},
},
})

View File

@ -403,6 +403,17 @@ h5 {
.color-input-placeholder {
color: var(--app-input-color-placeholder);
}
/*
头像渐变背景
*/
.avatar-gradient {
background: var(--app-avatar-gradient-color);
}
.avatar-light {
background: var(--el-color-primary-light-3);
}
.avatar-purple {
background: #7f3bf5;
}

View File

@ -103,7 +103,7 @@ import imageApi from '@/api/image'
import documentApi from '@/api/knowledge/document'
import useStore from '@/stores'
import { t } from '@/locales'
const { application, document, user } = useStore()
const { application, user } = useStore()
const route = useRoute()
const {

View File

@ -64,7 +64,7 @@ import { ref, watch, reactive } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import chatLogApi from '@/api/application/chat-log'
import useStore from '@/stores'
import paragraphApi from '@/api/knowledge/paragraph'
import { t } from '@/locales'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
@ -73,8 +73,6 @@ const {
params: { id },
} = route as any
const { paragraph } = useStore()
const emit = defineEmits(['refresh'])
const formRef = ref()
@ -119,14 +117,7 @@ function deleteMark() {
function getMark(data: any) {
chatLogApi
.getMarkChatRecord(
id as string,
data.chat_id,
data.id,
data.knowledge,
data.document,
loading,
)
.getMarkChatRecord(id as string, data.chat_id, data.id, data.knowledge, data.document, loading)
.then((res: any) => {
if (res.data.length > 0) {
form.value = res.data[0]
@ -143,8 +134,8 @@ const submit = async (formEl: FormInstance) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
paragraph
.asyncPutParagraph(
paragraphApi
.putParagraph(
form.value.knowledge,
form.value.document,
form.value.id,

View File

@ -305,7 +305,7 @@ import { ElTable } from 'element-plus'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
const { application, chatLog, document, user } = useStore()
const { application, chatLog, user } = useStore()
const route = useRoute()
const {
params: { id },

View File

@ -64,7 +64,7 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { MsgConfirm, MsgSuccess } from '@/utils/message'
import { t } from '@/locales'
import useStore from '@/stores'
const { knowledge, document } = useStore()
const { knowledge } = useStore()
const documentsFiles = computed(() => knowledge.documentsFiles)
const documentsType = computed(() => knowledge.documentsType)

View File

@ -599,8 +599,6 @@ import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vu
import EmbeddingContentDialog from '@/views/document/component/EmbeddingContentDialog.vue'
import { TaskType, State } from '@/utils/status'
import { t } from '@/locales'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
@ -609,7 +607,7 @@ const router = useRouter()
const {
params: { id, folderId }, // idknowledgeID
} = route as any
const { common, document } = useStore()
const { common } = useStore()
const storeKey = 'documents'
onBeforeRouteUpdate(() => {
common.savePage(storeKey, null)

View File

@ -15,7 +15,7 @@
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
</el-avatar>
</div>
<div class="content">
<div class="content ml-12">
<h4 class="text break-all">{{ questionTitle }}</h4>
</div>
</div>
@ -51,13 +51,14 @@
:description="item.content"
class="document-card layout-bg layout-bg cursor"
:class="item.is_active ? '' : 'disabled'"
:showIcon="false"
@click="editParagraph(item)"
>
<template #icon>
<el-avatar class="mr-12 avatar-light" :size="22"> {{ index + 1 + '' }}</el-avatar>
<el-avatar class="avatar-light" :size="22"> {{ index + 1 + '' }}</el-avatar>
</template>
<template #tag>
<div class="primary">{{ item.similarity?.toFixed(3) }}</div>
</template>
<div class="active-button primary">{{ item.similarity?.toFixed(3) }}</div>
<template #footer>
<div class="footer-content flex-between">
<el-text>
@ -84,7 +85,12 @@
</div>
</el-scrollbar>
</el-card>
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
<ParagraphDialog
ref="ParagraphDialogRef"
:title="title"
@refresh="refresh"
:apiType="apiType"
/>
<div class="hit-test__operate">
<el-popover :visible="popoverVisible" placement="right-end" :width="500" trigger="click">
@ -219,7 +225,6 @@
import { nextTick, ref, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { cloneDeep } from 'lodash'
// import applicationApi from '@/api/application/application'
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
import { arraySort } from '@/utils/common'
import emptyImg from '@/assets/hit-test-empty.png'
@ -227,7 +232,6 @@ import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute()
const {
meta: { activeMenu },
params: { id },
} = route as any
const apiType = computed(() => {
@ -261,13 +265,6 @@ const questionTitle = ref('')
const isDisabledChart = computed(() => !inputValue.value)
const isApplication = computed(() => {
return activeMenu.includes('application')
})
const isDataset = computed(() => {
return activeMenu.includes('knowledge')
})
function changeHandle(val: string) {
if (val === 'keywords') {
cloneForm.value.similarity = 0
@ -323,23 +320,14 @@ function getHitTestList() {
query_text: inputValue.value,
...formInline.value,
}
if (isDataset.value) {
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
.putKnowledgeHitTest(id, obj, loading)
.then((res: any) => {
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
questionTitle.value = inputValue.value
inputValue.value = ''
first.value = false
})
} else if (isApplication.value) {
// applicationApi.getApplicationHitTest(id, obj, loading).then((res) => {
// paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
// questionTitle.value = inputValue.value
// inputValue.value = ''
// first.value = false
// })
}
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
.putKnowledgeHitTest(id, obj, loading)
.then((res: any) => {
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
questionTitle.value = inputValue.value
inputValue.value = ''
first.value = false
})
}
function refresh(data: any) {
@ -438,11 +426,6 @@ onMounted(() => {})
-webkit-line-clamp: 5 !important;
height: 110px;
}
.active-button {
position: absolute;
right: 16px;
top: 16px;
}
}
}
</style>

View File

@ -44,9 +44,9 @@
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue'
import { groupBy } from 'lodash'
import useStore from '@/stores'
import type { knowledgeData } from '@/api/type/knowledge'
import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const props = defineProps<{
data?: {
@ -55,7 +55,6 @@ const props = defineProps<{
}
apiType: 'systemShare' | 'workspace' | 'systemManage'
}>()
const { model } = useStore()
const form = ref<knowledgeData>({
name: '',
desc: '',
@ -116,11 +115,9 @@ function validate() {
function getSelectModel() {
loading.value = true
model
.asyncGetSelectModel(props.apiType, { model_type: 'EMBEDDING' })
loadSharedApi({ type: 'model', systemType: props.apiType })
.getSelectModelList({ model_type: 'EMBEDDING' })
.then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
loading.value = false
})

View File

@ -321,8 +321,6 @@ import { numberFormat } from '@/utils/common'
import { t } from '@/locales'
import { useRouter, useRoute } from 'vue-router'
import { FolderSource } from '@/enums/common'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import permissionMap from '@/permission'
@ -481,10 +479,12 @@ watch(
function getList() {
const params = {
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
scope: apiType.value === 'systemShare' ? 'SHARED' : 'WORKSPACE',
[search_type.value]: search_form.value[search_type.value],
}
knowledge
.asyncGetKnowledgeListPage(paginationConfig, isShared.value, apiType.value, params, loading)
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
.getKnowledgeListPage(paginationConfig, params, loading)
.then((res: any) => {
paginationConfig.total = res.data?.total
knowledge.setKnowledgeList([...knowledgeList.value, ...res.data.records])

View File

@ -140,8 +140,6 @@ import QrCodeTab from '@/views/login/scanCompinents/QrCodeTab.vue'
import {MsgConfirm, MsgError} from '@/utils/message.ts'
import * as dd from 'dingtalk-jsapi'
import {loadScript} from '@/utils/utils'
import {EditionConst} from '@/utils/permission/data'
import {hasPermission} from '@/utils/permission/index'
const router = useRouter()
const {login, user, theme} = useStore()

View File

@ -16,7 +16,7 @@
<script setup lang="ts">
import { onMounted, ref, defineAsyncComponent } from 'vue'
import useStore from '@/stores'
const { login } = useStore()
interface Tab {
key: string
value: string
@ -41,7 +41,7 @@ const activeKey = ref('')
const allConfigs = ref<PlatformConfig[]>([])
const config = ref<Config>({ app_key: '', app_secret: '' })
// const logoUrl = ref('')
const { login } = useStore()
async function getPlatformInfo() {
try {
return await login.getQrSource()

View File

@ -16,10 +16,10 @@ import { MsgError } from '@/utils/message'
import useStore from '@/stores'
import { getBrowserLang } from '@/locales'
const router = useRouter()
const { login } = useStore()
const wwLogin = ref({})
const obj = ref<any>({ isWeComLogin: false })
const { login } = useStore()
const props = defineProps<{
config: {

View File

@ -131,12 +131,9 @@ import EditModel from '@/views/model/component/EditModel.vue'
// import DownloadLoading from '@/components/loading/DownloadLoading.vue'
import { MsgConfirm } from '@/utils/message'
import { modelType } from '@/enums/model'
import useStore from '@/stores'
import ParamSettingDialog from './ParamSettingDialog.vue'
import AuthorizedWorkspace from '@/views/system-shared/AuthorizedWorkspaceDialog.vue'
import { t } from '@/locales'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission'
import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
@ -149,7 +146,6 @@ const props = defineProps<{
apiType: 'systemShare' | 'workspace' | 'systemManage'
}>()
const { user } = useStore()
const permissionPrecise = computed(() => {
return permissionMap['model'][props.apiType]

View File

@ -66,7 +66,12 @@
class="maxkb-md"
/>
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
<ParagraphDialog
ref="ParagraphDialogRef"
:title="title"
@refresh="refresh"
:apiType="apiType"
/>
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
</el-card>
@ -74,17 +79,16 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
import { t } from '@/locales'
import useStore from '@/stores'
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
import SelectDocumentDialog from '@/views/paragraph/component/SelectDocumentDialog.vue'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { t } from '@/locales'
const props = defineProps<{
data: any
disabled?: boolean
}>()
const { paragraph } = useStore()
const route = useRoute()
const {
@ -115,8 +119,8 @@ function changeState(row: any) {
const obj = {
is_active: !row.is_active,
}
paragraph
.asyncPutParagraph(id, documentId, row.id, obj, changeStateloading)
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.putParagraph(id, documentId, row.id, obj, changeStateloading)
.then((res) => {
emit('changeState', row.id)
return true
@ -142,10 +146,12 @@ function deleteParagraph(row: any) {
},
)
.then(() => {
paragraph.asyncDelParagraph(id, documentId, row.id, loading).then(() => {
emit('deleteParagraph', row.id)
MsgSuccess(t('common.deleteSuccess'))
})
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.delParagraph(id, documentId, row.id, loading)
.then(() => {
emit('deleteParagraph', row.id)
MsgSuccess(t('common.deleteSuccess'))
})
})
.catch(() => {})
}

View File

@ -35,6 +35,7 @@
:paragraphId="paragraphId"
:docId="document_id"
:knowledgeId="dataset_id"
:apiType="apiType"
ref="ProblemRef"
/>
</el-col>
@ -55,14 +56,12 @@ import { useRoute } from 'vue-router'
import { cloneDeep, debounce } from 'lodash'
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
import paragraphApi from '@/api/knowledge/paragraph'
import useStore from '@/stores'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const props = defineProps({
title: String,
})
const { paragraph } = useStore()
const props = defineProps<{
title: String
apiType: 'systemShare' | 'workspace' | 'systemManage'
}>()
const route = useRoute()
const {
@ -121,8 +120,8 @@ const submitHandle = async () => {
if (await paragraphFormRef.value?.validate()) {
loading.value = true
if (paragraphId.value) {
paragraph
.asyncPutParagraph(
loadSharedApi({ type: 'paragraph', systemType: props.apiType })
.putParagraph(
dataset_id.value,
documentId || document_id.value,
paragraphId.value,
@ -145,10 +144,12 @@ const submitHandle = async () => {
position: String(position.value) ? position.value : null,
...paragraphFormRef.value?.form,
}
paragraphApi.postParagraph(id, documentId, obj, loading).then((res) => {
dialogVisible.value = false
emit('refresh')
})
loadSharedApi({ type: 'paragraph', systemType: props.apiType })
.postParagraph(id, documentId, obj, loading)
.then(() => {
dialogVisible.value = false
emit('refresh')
})
}
}
}

View File

@ -57,21 +57,20 @@
<script setup lang="ts">
import { ref, nextTick, onMounted, onUnmounted, watch } from 'vue'
import { useRoute } from 'vue-router'
import paragraphApi from '@/api/knowledge/paragraph'
import useStore from '@/stores'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const props = defineProps({
paragraphId: String,
docId: String,
knowledgeId: String,
})
const props = defineProps<{
paragraphId: String
docId: String
knowledgeId: String
apiType: 'systemShare' | 'workspace' | 'systemManage'
}>()
const route = useRoute()
const {
params: { id, documentId }, // idknowledgeId
} = route as any
const { problem, paragraph } = useStore()
const inputRef = ref()
const loading = ref(false)
const isAddProblem = ref(false)
@ -96,14 +95,12 @@ watch(
function delProblemHandle(item: any, index: number) {
if (item.id) {
paragraph
.asyncDisassociationProblem(
props.knowledgeId || id,
documentId || props.docId,
props.paragraphId || '',
item.id,
loading,
)
const obj = {
paragraph_id: props.paragraphId || '',
problem_id: item.id,
}
loadSharedApi({ type: 'paragraph', systemType: props.apiType })
.putDisassociationProblem(props.knowledgeId || id, documentId || props.docId, obj, loading)
.then((res: any) => {
getProblemList()
})
@ -114,9 +111,13 @@ function delProblemHandle(item: any, index: number) {
function getProblemList() {
loading.value = true
paragraphApi
.getParagraphProblem(props.knowledgeId || id, documentId || props.docId, props.paragraphId || '')
.then((res) => {
loadSharedApi({ type: 'paragraph', systemType: props.apiType })
.getParagraphProblem(
props.knowledgeId || id,
documentId || props.docId,
props.paragraphId || '',
)
.then((res: any) => {
problemList.value = res.data
loading.value = false
})
@ -133,15 +134,18 @@ function addProblem() {
}
function addProblemHandle(val: string) {
if (props.paragraphId) {
const obj = {
paragraph_id: props.paragraphId,
problem_id: val,
}
const api = problemOptions.value.some((option) => option.id === val)
? paragraph.asyncAssociationProblem(
? loadSharedApi({ type: 'paragraph', systemType: props.apiType }).putAssociationProblem(
props.knowledgeId || id,
documentId || props.docId,
props.paragraphId,
val,
obj,
loading,
)
: paragraphApi.postParagraphProblem(
: loadSharedApi({ type: 'paragraph', systemType: props.apiType }).postParagraphProblem(
props.knowledgeId || id,
documentId || props.docId,
props.paragraphId,
@ -172,8 +176,8 @@ const remoteMethod = (query: string) => {
}
function getProblemOption(filterText?: string) {
return problem
.asyncGetProblem(
return loadSharedApi({ type: 'problem', systemType: props.apiType })
.getProblemsPage(
props.knowledgeId || (id as string),
{ current_page: 1, page_size: 100 },
filterText && { content: filterText },

View File

@ -79,11 +79,8 @@
import { ref, watch, reactive, computed } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import paragraphApi from '@/api/knowledge/paragraph'
import useStore from '@/stores'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { t } from '@/locales'
const { knowledge, document } = useStore()
const route = useRoute()
const {
@ -160,9 +157,11 @@ function changeKnowledge(id: string) {
}
function getDocument(id: string) {
document.asyncGetKnowledgeDocument(id, apiType.value, optionLoading).then((res: any) => {
documentList.value = res.data?.filter((v: any) => v.id !== documentId)
})
loadSharedApi({ type: 'document', systemType: apiType.value })
.getDocumentList(id, optionLoading)
.then((res: any) => {
documentList.value = res.data?.filter((v: any) => v.id !== documentId)
})
}
const open = (list: any) => {
@ -177,7 +176,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
const obj = {
id_list: paragraphList.value,
}
paragraphApi
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.putMigrateMulParagraph(
id,
documentId,

View File

@ -136,7 +136,12 @@
</span>
</div>
</el-card>
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
<ParagraphDialog
ref="ParagraphDialogRef"
:title="title"
:apiType="apiType"
@refresh="refresh"
/>
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
</div>
@ -151,7 +156,6 @@ import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vu
import { VueDraggable } from 'vue-draggable-plus'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import useStore from '@/stores'
import { t } from '@/locales'
const route = useRoute()
const {

View File

@ -33,28 +33,37 @@
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, watch } from 'vue'
import { ref, reactive, watch, computed } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import { MsgSuccess } from '@/utils/message'
import useStore from '@/stores'
import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute()
const {
params: { id }
params: { id },
} = route as any
const { problem } = useStore()
const apiType = computed(() => {
if (route.path.includes('shared')) {
return 'systemShare'
} else if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh'])
const problemFormRef = ref()
const loading = ref<boolean>(false)
const form = ref<any>({
data: ''
data: '',
})
const rules = reactive({
data: [{ required: true, message: t('views.problem.tip.requiredMessage'), trigger: 'blur' }]
data: [{ required: true, message: t('views.problem.tip.requiredMessage'), trigger: 'blur' }],
})
const dialogVisible = ref<boolean>(false)
@ -62,7 +71,7 @@ const dialogVisible = ref<boolean>(false)
watch(dialogVisible, (bool) => {
if (!bool) {
form.value = {
data: ''
data: '',
}
}
})
@ -78,11 +87,13 @@ const submit = async (formEl: FormInstance | undefined) => {
const arr = form.value.data.split('\n').filter(function (item: string) {
return item !== ''
})
problem.asyncPostProblem(id, arr, loading).then((res: any) => {
MsgSuccess(t('common.createSuccess'))
emit('refresh')
dialogVisible.value = false
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.postProblems(id, arr, loading)
.then((res: any) => {
MsgSuccess(t('common.createSuccess'))
emit('refresh')
dialogVisible.value = false
})
}
})
}

View File

@ -19,28 +19,26 @@
<template v-for="(item, index) in paragraphList" :key="index">
<CardBox
:title="item.title || '-'"
class="paragraph-source-card cursor mb-8"
class="cursor mb-8"
:showIcon="false"
@click.stop="editParagraph(item)"
style="height: 210px"
>
<div class="active-button">
<span class="mr-4">
<el-tooltip
effect="dark"
:content="$t('views.problem.setting.cancelRelated')"
placement="top"
>
<el-button type="primary" text @click.stop="disassociation(item)">
<AppIcon iconName="app-quxiaoguanlian"></AppIcon>
</el-button>
</el-tooltip>
</span>
</div>
<template #description>
<el-scrollbar height="80">
{{ item.content }}
</el-scrollbar>
<template #tag>
<el-tooltip
effect="dark"
:content="$t('views.problem.setting.cancelRelated')"
placement="top"
>
<el-button type="primary" text @click.stop="disassociation(item)">
<AppIcon iconName="app-quxiaoguanlian"></AppIcon>
</el-button>
</el-tooltip>
</template>
<el-scrollbar height="110">
{{ item.content }}
</el-scrollbar>
<template #footer>
<div class="footer-content flex-between">
<el-text>
@ -60,6 +58,7 @@
<ParagraphDialog
ref="ParagraphDialogRef"
:title="$t('views.paragraph.editParagraph')"
:apiType="apiType"
@refresh="refresh"
/>
<RelateProblemDialog ref="RelateProblemDialogRef" @refresh="refresh" />
@ -83,11 +82,10 @@
<script setup lang="ts">
import { ref, reactive, computed, watch } from 'vue'
import { useRoute } from 'vue-router'
import problemApi from '@/api/knowledge/problem'
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
import RelateProblemDialog from './RelateProblemDialog.vue'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
import useStore from '@/stores'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { t } from '@/locales'
const props = withDefaults(
defineProps<{
@ -119,7 +117,16 @@ const {
params: { id },
} = route
const { paragraph } = useStore()
const apiType = computed(() => {
if (route.path.includes('shared')) {
return 'systemShare'
} else if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const RelateProblemDialogRef = ref()
const ParagraphDialogRef = ref()
const loading = ref(false)
@ -127,14 +134,12 @@ const visible = ref(false)
const paragraphList = ref<any[]>([])
function disassociation(item: any) {
paragraph
.asyncDisassociationProblem(
item.knowledge_id,
item.document_id,
item.id,
props.currentId,
loading,
)
const obj = {
paragraph_id: item.id,
problem_id: props.currentId,
}
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.putDisassociationProblem(item.knowledge_id, item.document_id, obj, loading)
.then(() => {
getRecord()
})
@ -153,10 +158,12 @@ function editName(val: string) {
const obj = {
content: val,
}
problemApi.putProblems(id as string, props.currentId, obj, loading).then(() => {
emit('update:currentContent', val)
MsgSuccess(t('common.modifySuccess'))
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.putProblems(id as string, props.currentId, obj, loading)
.then(() => {
emit('update:currentContent', val)
MsgSuccess(t('common.modifySuccess'))
})
} else {
MsgError(t('views.problem.tip.errorMessage'))
}
@ -168,9 +175,11 @@ function closeHandle() {
function getRecord() {
if (props.currentId && visible.value) {
problemApi.getDetailProblems(id as string, props.currentId, loading).then((res) => {
paragraphList.value = res.data
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.getDetailProblems(id as string, props.currentId, loading)
.then((res: any) => {
paragraphList.value = res.data
})
}
}

View File

@ -111,12 +111,9 @@
<script setup lang="ts">
import { ref, watch, reactive, computed } from 'vue'
import { useRoute } from 'vue-router'
import problemApi from '@/api/knowledge/problem'
import paragraphApi from '@/api/knowledge/paragraph'
import useStore from '@/stores'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales'
const { problem, document, paragraph } = useStore()
const route = useRoute()
const {
@ -168,10 +165,12 @@ function mulAssociation() {
document_id: item.document_id,
})),
}
problemApi.putMulAssociationProblem(id, data, loading).then(() => {
MsgSuccess(t('views.problem.tip.relatedSuccess'))
dialogVisible.value = false
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.putMulAssociationProblem(id, data, loading)
.then(() => {
MsgSuccess(t('views.problem.tip.relatedSuccess'))
dialogVisible.value = false
})
}
function associationClick(item: any) {
@ -182,27 +181,19 @@ function associationClick(item: any) {
associationParagraph.value.push(item)
}
} else {
const obj = {
paragraph_id: item.id,
problem_id: currentProblemId.value as string,
}
if (isAssociation(item.id)) {
paragraph
.asyncDisassociationProblem(
id,
item.document_id,
item.id,
currentProblemId.value as string,
loading,
)
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.putDisassociationProblem(id, item.document_id, obj, loading)
.then(() => {
getRecord(currentProblemId.value)
})
} else {
paragraph
.asyncAssociationProblem(
id,
item.document_id,
item.id,
currentProblemId.value as string,
loading,
)
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.putAssociationProblem(id, item.document_id, obj, loading)
.then(() => {
getRecord(currentProblemId.value)
})
@ -224,16 +215,19 @@ function clickDocumentHandle(item: any) {
}
function getDocument() {
document.asyncGetKnowledgeDocument(id, apiType.value, loading).then((res: any) => {
cloneDocumentList.value = res.data
documentList.value = res.data
currentDocument.value = cloneDocumentList.value?.length > 0 ? cloneDocumentList.value[0].id : ''
currentDocument.value && getParagraphList(currentDocument.value)
})
loadSharedApi({ type: 'document', systemType: apiType.value })
.getDocumentList(id, loading)
.then((res: any) => {
cloneDocumentList.value = res.data
documentList.value = res.data
currentDocument.value =
cloneDocumentList.value?.length > 0 ? cloneDocumentList.value[0].id : ''
currentDocument.value && getParagraphList(currentDocument.value)
})
}
function getParagraphList(documentId: string) {
paragraphApi
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.getParagraphPage(
id,
(documentId || currentDocument.value) as string,
@ -241,7 +235,7 @@ function getParagraphList(documentId: string) {
search.value && { [searchType.value]: search.value },
loading,
)
.then((res) => {
.then((res: any) => {
paragraphList.value = [...paragraphList.value, ...res.data.records]
paginationConfig.total = res.data.total
})
@ -249,9 +243,11 @@ function getParagraphList(documentId: string) {
//
function getRecord(problemId: string) {
problemApi.getDetailProblems(id as string, problemId as string, loading).then((res) => {
associationParagraph.value = res.data
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.getDetailProblems(id as string, problemId as string, loading)
.then((res: any) => {
associationParagraph.value = res.data
})
}
function associationCount(documentId: string) {

View File

@ -6,17 +6,23 @@
<div class="p-24">
<div class="flex-between">
<div>
<el-button type="primary" @click="createProblem"
<el-button
type="primary"
@click="createProblem"
v-if="permissionPrecise.problem_create(id)"
>
{{ $t('views.problem.createProblem') }}
</el-button>
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0"
<el-button
@click="relateProblem()"
:disabled="multipleSelection.length === 0"
v-if="permissionPrecise.problem_relate(id)"
>
{{ $t('views.problem.relateParagraph.title') }}
</el-button>
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0"
<el-button
@click="deleteMulDocument"
:disabled="multipleSelection.length === 0"
v-if="permissionPrecise.problem_delete(id)"
>
{{ $t('views.problem.setting.batchDelete') }}
@ -41,7 +47,6 @@
:quickCreateName="$t('views.problem.quickCreateName')"
:quickCreatePlaceholder="$t('views.problem.quickCreateProblem')"
:quickCreateMaxlength="256"
@sizeChange="handleSizeChange"
@changePage="getList"
@cell-mouse-enter="cellMouseEnter"
@ -106,16 +111,24 @@
:content="$t('views.problem.relateParagraph.title')"
placement="top"
>
<el-button type="primary" text @click.stop="relateProblem(row)"
v-if="permissionPrecise.problem_relate(id)" >
<el-button
type="primary"
text
@click.stop="relateProblem(row)"
v-if="permissionPrecise.problem_relate(id)"
>
<el-icon><Connection /></el-icon>
</el-button>
</el-tooltip>
</span>
<span>
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
<el-button type="primary" text @click.stop="deleteProblem(row)"
v-if="permissionPrecise.problem_delete(id)" >
<el-button
type="primary"
text
@click.stop="deleteProblem(row)"
v-if="permissionPrecise.problem_delete(id)"
>
<el-icon><Delete /></el-icon>
</el-button>
</el-tooltip>
@ -145,25 +158,20 @@
import { ref, onMounted, reactive, onBeforeUnmount, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ElTable } from 'element-plus'
import problemApi from '@/api/knowledge/problem'
import CreateProblemDialog from './component/CreateProblemDialog.vue'
import DetailProblemDrawer from './component/DetailProblemDrawer.vue'
import RelateProblemDialog from './component/RelateProblemDialog.vue'
import { datetimeFormat } from '@/utils/time'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
import type { Dict } from '@/api/type/common'
import useStore from '@/stores'
import { t } from '@/locales'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import permissionMap from '@/permission'
const route = useRoute()
const {
params: { id }, // id
} = route as any
const { folder, user } = useStore()
const apiType = computed(() => {
if (route.path.includes('shared')) {
@ -178,9 +186,6 @@ const permissionPrecise = computed(() => {
return permissionMap['knowledge'][apiType.value]
})
const { problem } = useStore()
const RelateProblemDialogRef = ref()
const DetailProblemRef = ref()
const CreateProblemDialogRef = ref()
@ -240,9 +245,9 @@ const handleSelectionChange = (val: any[]) => {
function creatQuickHandle(val: string) {
loading.value = true
const obj = [val]
problem
.asyncPostProblem(id, obj)
.then((res) => {
loadSharedApi({ type: 'problem', systemType: apiType.value })
.postProblems(id, obj)
.then(() => {
getList()
MsgSuccess(t('common.createSuccess'))
})
@ -258,11 +263,13 @@ function deleteMulDocument() {
arr.push(v.id)
}
})
problemApi.putMulProblem(id, arr, loading).then(() => {
MsgSuccess(t('views.document.delete.successMessage'))
multipleTableRef.value?.clearSelection()
getList()
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.putMulProblem(id, arr, loading)
.then(() => {
MsgSuccess(t('views.document.delete.successMessage'))
multipleTableRef.value?.clearSelection()
getList()
})
}
function deleteProblem(row: any) {
@ -275,10 +282,12 @@ function deleteProblem(row: any) {
},
)
.then(() => {
problemApi.delProblems(id, row.id, loading).then(() => {
MsgSuccess(t('common.deleteSuccess'))
getList()
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.delProblems(id, row.id, loading)
.then(() => {
MsgSuccess(t('common.deleteSuccess'))
getList()
})
})
.catch(() => {})
}
@ -288,10 +297,12 @@ function editName(val: string, problemId: string) {
const obj = {
content: val,
}
problemApi.putProblems(id, problemId, obj, loading).then(() => {
getList()
MsgSuccess(t('common.modifySuccess'))
})
loadSharedApi({ type: 'problem', systemType: apiType.value })
.putProblems(id, problemId, obj, loading)
.then(() => {
getList()
MsgSuccess(t('common.modifySuccess'))
})
} else {
MsgError(t('views.problem.tip.errorMessage'))
}
@ -352,7 +363,7 @@ const preChatRecord = () => {
return
}
paginationConfig.current_page = paginationConfig.current_page - 1
getList().then((ok) => {
getList().then(() => {
index = paginationConfig.page_size - 1
currentClickId.value = problemData.value[index].id
currentContent.value = problemData.value[index].content
@ -384,8 +395,8 @@ function handleSizeChange() {
}
function getList() {
return problem
.asyncGetProblem(
return loadSharedApi({ type: 'problem', systemType: apiType.value })
.getProblemsPage(
id as string,
paginationConfig,
filterText.value && { content: filterText.value },

View File

@ -20,10 +20,6 @@ import OIDC from './component/OIDC.vue'
//import SCAN from './component/SCAN.vue'
import OAuth2 from './component/OAuth2.vue'
import { t } from '@/locales'
import useStore from '@/stores'
const { user } = useStore()
const router = useRouter()
const activeName = ref('LDAP')
const tabList = [

View File

@ -98,7 +98,7 @@ import { EditionConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
import WorkspaceApi from '@/api/workspace/workspace.ts'
import type { WorkspaceItem } from '@/api/type/workspace'
const { user } = useStore()
const loading = ref(false)
const rLoading = ref(false)
const memberList = ref<any[]>([]) //
@ -109,7 +109,7 @@ const filterText = ref('')
const activeName = ref(AuthorizationEnum.KNOWLEDGE)
const tableHeight = ref(0)
const { user } = useStore()
const settingTags = reactive([
{

View File

@ -301,8 +301,6 @@ import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
import AuthorizedWorkspace from '@/views/system-shared/AuthorizedWorkspaceDialog.vue'
import { isAppIcon } from '@/utils/common'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
import { FolderSource } from '@/enums/common'
import ToolStoreDialog from '@/views/tool/toolStore/ToolStoreDialog.vue'
import AddInternalFunctionDialog from '@/views/tool/toolStore/AddInternalFunctionDialog.vue'
@ -574,9 +572,11 @@ watch(
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value],
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
scope: systemType === 'systemShare' ? 'SHARED' : 'WORKSPACE',
}
tool
.asyncGetToolListPage(paginationConfig, isShared.value, apiType.value, params, loading)
loadSharedApi({ type: 'tool', isShared: isShared.value, systemType: apiType.value })
.getToolListPage(paginationConfig, params, loading)
.then((res: any) => {
paginationConfig.total = res.data?.total
tool.setToolList([...tool.toolList, ...res.data?.records])

View File

@ -173,8 +173,6 @@ import { cloneDeep, set, groupBy } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted } from 'vue'
import applicationApi from '@/api/application/application'
import modelAPI from '@/api/model/model.ts'
import useStore from '@/stores'
import { isLastNode } from '@/workflow/common/data'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
@ -272,11 +270,11 @@ const validate = () => {
function getSelectModel() {
if (id) {
modelAPI.getSelectModelList({ model_type: 'LLM' }).then((res: any) => {
model.asyncGetSelectModel({ model_type: 'LLM' }).then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace').then((res: any) => {
model.asyncGetSelectModel().then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -171,8 +171,6 @@ import { groupBy, set } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted } from 'vue'
import applicationApi from '@/api/application/application'
import modelAPI from '@/api/model/model.ts'
import { MsgError, MsgSuccess, MsgWarning } from '@/utils/message'
import { t } from '@/locales'
import TTSModeParamSettingDialog from '@/views/application/component/TTSModeParamSettingDialog.vue'
@ -180,11 +178,13 @@ import ApiInputFieldTable from './component/ApiInputFieldTable.vue'
import UserInputFieldTable from './component/UserInputFieldTable.vue'
import FileUploadSettingDialog from '@/workflow/nodes/base-node/component/FileUploadSettingDialog.vue'
import { useRoute } from 'vue-router'
import useStore from '@/stores'
const route = useRoute()
const {
params: { id },
} = route as any
const { model } = useStore()
const props = defineProps<{ nodeModel: any }>()
const sttModelOptions = ref<any>(null)
@ -253,13 +253,13 @@ const validate = () => {
}
function getSTTModel() {
modelAPI.getSelectModelList({ model_type: 'STT' }).then((res: any) => {
model.asyncGetSelectModel({ model_type: 'STT' }).then((res: any) => {
sttModelOptions.value = groupBy(res?.data, 'provider')
})
}
function getTTSModel() {
modelAPI.getSelectModelList({ model_type: 'TTS' }).then((res: any) => {
model.asyncGetSelectModel({ model_type: 'TTS' }).then((res: any) => {
ttsModelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -156,7 +156,6 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import type { FormInstance } from 'element-plus'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
@ -226,7 +225,7 @@ function getSelectModel() {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace').then((res: any) => {
model.asyncGetSelectModel().then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -172,7 +172,6 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus'
@ -246,7 +245,7 @@ function getSelectModel() {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace').then((res: any) => {
model.asyncGetSelectModel().then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -227,7 +227,7 @@ function getSelectModel() {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace').then((res: any) => {
model.asyncGetSelectModel().then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -176,10 +176,8 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
import ParamSettingDialog from './ParamSettingDialog.vue'
import { ref, computed, onMounted } from 'vue'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import { useRoute } from 'vue-router'
const route = useRoute()
const {
@ -242,7 +240,7 @@ function getSelectModel() {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace', { model_type: 'RERANKER' }).then((res: any) => {
model.asyncGetSelectModel({ model_type: 'RERANKER' }).then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -99,7 +99,6 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus'
@ -161,7 +160,7 @@ function getSelectModel() {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace').then((res: any) => {
model.asyncGetSelectModel().then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}

View File

@ -105,9 +105,10 @@
</template>
<script setup lang="ts">
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import TTSModeParamSettingDialog from '@/views/application/component/TTSModeParamSettingDialog.vue'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
@ -119,7 +120,6 @@ const route = useRoute()
const {
params: { id },
} = route as any
import TTSModeParamSettingDialog from '@/views/application/component/TTSModeParamSettingDialog.vue'
const TTSModeParamSettingDialogRef = ref<InstanceType<typeof TTSModeParamSettingDialog>>()
const { model } = useStore()
@ -176,7 +176,7 @@ function getSelectModel() {
modelOptions.value = groupBy(res?.data, 'provider')
})
} else {
model.asyncGetSelectModel('workspace').then((res: any) => {
model.asyncGetSelectModel().then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider')
})
}