|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <template v-if="state.indexMethod.show">
|
|
|
|
|
|
+ <template v-if="indexMethod">
|
|
<div class="__czr-title_1 mb-[0.5rem]">索引方式</div>
|
|
<div class="__czr-title_1 mb-[0.5rem]">索引方式</div>
|
|
<div class="flex w-full gap-[1rem]">
|
|
<div class="flex w-full gap-[1rem]">
|
|
<div
|
|
<div
|
|
@@ -62,7 +62,7 @@
|
|
/>使用高质量模式进行嵌入后,无法切换回经济模式。
|
|
/>使用高质量模式进行嵌入后,无法切换回经济模式。
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
- <template v-if="state.embedding.show">
|
|
|
|
|
|
+ <template v-if="embedding">
|
|
<div class="__czr-title_1 mb-[0.5rem]">Embedding 模型</div>
|
|
<div class="__czr-title_1 mb-[0.5rem]">Embedding 模型</div>
|
|
<CzrFormColumn
|
|
<CzrFormColumn
|
|
required
|
|
required
|
|
@@ -75,7 +75,7 @@
|
|
:clearable="false"
|
|
:clearable="false"
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
- <template v-if="state.searchMethod.show">
|
|
|
|
|
|
+ <template v-if="searchMethod">
|
|
<div class="__czr-title_1">检索方式</div>
|
|
<div class="__czr-title_1">检索方式</div>
|
|
<div
|
|
<div
|
|
class="mt-[1rem] w-full cursor-pointer rounded-[var(--czr-gap)] bg-[#ffffff]"
|
|
class="mt-[1rem] w-full cursor-pointer rounded-[var(--czr-gap)] bg-[#ffffff]"
|
|
@@ -534,7 +534,11 @@ import { ElMessage } from 'element-plus'
|
|
|
|
|
|
const DictionaryStore = useDictionaryStore()
|
|
const DictionaryStore = useDictionaryStore()
|
|
const emit = defineEmits([])
|
|
const emit = defineEmits([])
|
|
-const props = defineProps({})
|
|
|
|
|
|
+const props = defineProps({
|
|
|
|
+ indexMethod: { default: true },
|
|
|
|
+ embedding: { default: true },
|
|
|
|
+ searchMethod: { default: true },
|
|
|
|
+})
|
|
const { proxy }: any = getCurrentInstance()
|
|
const { proxy }: any = getCurrentInstance()
|
|
enum SearchMethodType {
|
|
enum SearchMethodType {
|
|
Vector = 'VECTOR',
|
|
Vector = 'VECTOR',
|
|
@@ -545,15 +549,12 @@ const state: any = reactive({
|
|
optionsEmbedding: [],
|
|
optionsEmbedding: [],
|
|
optionsRerank: [],
|
|
optionsRerank: [],
|
|
indexMethod: {
|
|
indexMethod: {
|
|
- show: true,
|
|
|
|
value: '高质量',
|
|
value: '高质量',
|
|
},
|
|
},
|
|
embedding: {
|
|
embedding: {
|
|
- show: true,
|
|
|
|
value: '',
|
|
value: '',
|
|
},
|
|
},
|
|
searchMethod: {
|
|
searchMethod: {
|
|
- show: true,
|
|
|
|
value: SearchMethodType.Vector,
|
|
value: SearchMethodType.Vector,
|
|
[SearchMethodType.Vector]: {
|
|
[SearchMethodType.Vector]: {
|
|
isRerank: 1,
|
|
isRerank: 1,
|
|
@@ -595,15 +596,12 @@ const optionsRerankMapCpt = computed(() => {
|
|
})
|
|
})
|
|
const reset = () => {
|
|
const reset = () => {
|
|
state.indexMethod = {
|
|
state.indexMethod = {
|
|
- show: true,
|
|
|
|
value: '高质量',
|
|
value: '高质量',
|
|
}
|
|
}
|
|
state.embedding = {
|
|
state.embedding = {
|
|
- show: true,
|
|
|
|
value: '',
|
|
value: '',
|
|
}
|
|
}
|
|
state.searchMethod = {
|
|
state.searchMethod = {
|
|
- show: true,
|
|
|
|
value: SearchMethodType.Vector,
|
|
value: SearchMethodType.Vector,
|
|
[SearchMethodType.Vector]: {
|
|
[SearchMethodType.Vector]: {
|
|
isRerank: 1,
|
|
isRerank: 1,
|
|
@@ -630,134 +628,150 @@ const reset = () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const getData = () => {
|
|
const getData = () => {
|
|
- const result = {
|
|
|
|
- indexingTechnique: state.indexMethod.value,
|
|
|
|
- embeddingModelId: state.embedding.value,
|
|
|
|
- embeddingModel: optionsEmbeddingMapCpt.value.get(state.embedding.value)
|
|
|
|
- .label,
|
|
|
|
- indexConfig: {
|
|
|
|
- type: state.searchMethod.value,
|
|
|
|
- },
|
|
|
|
|
|
+ const result: any = {}
|
|
|
|
+
|
|
|
|
+ if (props.indexMethod) {
|
|
|
|
+ result.indexingTechnique = state.indexMethod.value
|
|
}
|
|
}
|
|
- switch (state.searchMethod.value) {
|
|
|
|
- case SearchMethodType.Vector:
|
|
|
|
- {
|
|
|
|
- result.indexConfig.isRerank =
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].isRerank
|
|
|
|
- result.indexConfig.rerankTypeId =
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].rerank
|
|
|
|
- result.indexConfig.rerankType = optionsRerankMapCpt.value.get(
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].rerank,
|
|
|
|
- ).label
|
|
|
|
- result.indexConfig.topK =
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].topK
|
|
|
|
- result.indexConfig.isScore =
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].isScore
|
|
|
|
- result.indexConfig.score =
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].score
|
|
|
|
- }
|
|
|
|
- break
|
|
|
|
- case SearchMethodType.Global:
|
|
|
|
- {
|
|
|
|
- result.indexConfig.isRerank =
|
|
|
|
- state.searchMethod[SearchMethodType.Global].isRerank
|
|
|
|
- result.indexConfig.rerankTypeId =
|
|
|
|
- state.searchMethod[SearchMethodType.Global].rerank
|
|
|
|
- result.indexConfig.rerankType = optionsRerankMapCpt.value.get(
|
|
|
|
- state.searchMethod[SearchMethodType.Global].rerank,
|
|
|
|
- ).label
|
|
|
|
- result.indexConfig.topK =
|
|
|
|
- state.searchMethod[SearchMethodType.Global].topK
|
|
|
|
- result.indexConfig.isScore =
|
|
|
|
- state.searchMethod[SearchMethodType.Global].isScore
|
|
|
|
- result.indexConfig.score =
|
|
|
|
- state.searchMethod[SearchMethodType.Global].score
|
|
|
|
- }
|
|
|
|
- break
|
|
|
|
- case SearchMethodType.Mix:
|
|
|
|
- {
|
|
|
|
- result.indexConfig.weightRerank =
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].indexMethod
|
|
|
|
- result.indexConfig.semantics =
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].weight
|
|
|
|
- result.indexConfig.keyword =
|
|
|
|
- 1 - state.searchMethod[SearchMethodType.Mix].weight
|
|
|
|
- result.indexConfig.rerankTypeId =
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].rerank
|
|
|
|
- result.indexConfig.rerankType =
|
|
|
|
- optionsRerankMapCpt.value.get(
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].rerank,
|
|
|
|
- )?.label || ''
|
|
|
|
- result.indexConfig.topK = state.searchMethod[SearchMethodType.Mix].topK
|
|
|
|
- result.indexConfig.isScore =
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].isScore
|
|
|
|
- result.indexConfig.score =
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].score
|
|
|
|
- }
|
|
|
|
- break
|
|
|
|
|
|
+ if (props.embedding) {
|
|
|
|
+ result.embeddingModelId = state.embedding.value
|
|
|
|
+ result.embeddingModel = optionsEmbeddingMapCpt.value.get(
|
|
|
|
+ state.embedding.value,
|
|
|
|
+ ).label
|
|
|
|
+ }
|
|
|
|
+ if (props.searchMethod) {
|
|
|
|
+ result.indexConfig = {
|
|
|
|
+ type: state.searchMethod.value,
|
|
|
|
+ }
|
|
|
|
+ switch (state.searchMethod.value) {
|
|
|
|
+ case SearchMethodType.Vector:
|
|
|
|
+ {
|
|
|
|
+ result.indexConfig.isRerank =
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].isRerank
|
|
|
|
+ result.indexConfig.rerankTypeId =
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].rerank
|
|
|
|
+ result.indexConfig.rerankType = optionsRerankMapCpt.value.get(
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].rerank,
|
|
|
|
+ ).label
|
|
|
|
+ result.indexConfig.topK =
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].topK
|
|
|
|
+ result.indexConfig.isScore =
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].isScore
|
|
|
|
+ result.indexConfig.score =
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].score
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ case SearchMethodType.Global:
|
|
|
|
+ {
|
|
|
|
+ result.indexConfig.isRerank =
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].isRerank
|
|
|
|
+ result.indexConfig.rerankTypeId =
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].rerank
|
|
|
|
+ result.indexConfig.rerankType = optionsRerankMapCpt.value.get(
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].rerank,
|
|
|
|
+ ).label
|
|
|
|
+ result.indexConfig.topK =
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].topK
|
|
|
|
+ result.indexConfig.isScore =
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].isScore
|
|
|
|
+ result.indexConfig.score =
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].score
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ case SearchMethodType.Mix:
|
|
|
|
+ {
|
|
|
|
+ result.indexConfig.weightRerank =
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod
|
|
|
|
+ result.indexConfig.semantics =
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].weight
|
|
|
|
+ result.indexConfig.keyword =
|
|
|
|
+ 1 - state.searchMethod[SearchMethodType.Mix].weight
|
|
|
|
+ result.indexConfig.rerankTypeId =
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].rerank
|
|
|
|
+ result.indexConfig.rerankType =
|
|
|
|
+ optionsRerankMapCpt.value.get(
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].rerank,
|
|
|
|
+ )?.label || ''
|
|
|
|
+ result.indexConfig.topK =
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].topK
|
|
|
|
+ result.indexConfig.isScore =
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].isScore
|
|
|
|
+ result.indexConfig.score =
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].score
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
const init = ({ indexingTechnique, embeddingModelId, indexConfig }) => {
|
|
const init = ({ indexingTechnique, embeddingModelId, indexConfig }) => {
|
|
reset()
|
|
reset()
|
|
- state.indexMethod.value = indexingTechnique
|
|
|
|
- state.embedding.value = embeddingModelId
|
|
|
|
- state.searchMethod.value = indexConfig.type
|
|
|
|
- switch (state.searchMethod.value) {
|
|
|
|
- case SearchMethodType.Vector:
|
|
|
|
- {
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].isRerank = Number(
|
|
|
|
- indexConfig.isRerank,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].rerank =
|
|
|
|
- indexConfig.rerankTypeId
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].topK = Number(
|
|
|
|
- indexConfig.topK,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].isScore = Number(
|
|
|
|
- indexConfig.isScore,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Vector].score = Number(
|
|
|
|
- indexConfig.score,
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- break
|
|
|
|
- case SearchMethodType.Global:
|
|
|
|
- {
|
|
|
|
- state.searchMethod[SearchMethodType.Global].isRerank = Number(
|
|
|
|
- indexConfig.isRerank,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Global].rerank =
|
|
|
|
- indexConfig.rerankTypeId
|
|
|
|
- state.searchMethod[SearchMethodType.Global].topK = Number(
|
|
|
|
- indexConfig.topK,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Global].isScore = Number(
|
|
|
|
- indexConfig.isScore,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Global].score = Number(
|
|
|
|
- indexConfig.score,
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- break
|
|
|
|
- case SearchMethodType.Mix:
|
|
|
|
- {
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].indexMethod =
|
|
|
|
- indexConfig.weightRerank
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].weight = Number(
|
|
|
|
- indexConfig.semantics,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].rerank =
|
|
|
|
- indexConfig.rerankTypeId
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].topK = Number(indexConfig.topK)
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].isScore = Number(
|
|
|
|
- indexConfig.isScore,
|
|
|
|
- )
|
|
|
|
- state.searchMethod[SearchMethodType.Mix].score = Number(
|
|
|
|
- indexConfig.score,
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- break
|
|
|
|
|
|
+ if (props.indexMethod) {
|
|
|
|
+ state.indexMethod.value = indexingTechnique
|
|
|
|
+ }
|
|
|
|
+ if (props.embedding) {
|
|
|
|
+ state.embedding.value = embeddingModelId
|
|
|
|
+ }
|
|
|
|
+ if (props.searchMethod) {
|
|
|
|
+ state.searchMethod.value = indexConfig.type
|
|
|
|
+ switch (state.searchMethod.value) {
|
|
|
|
+ case SearchMethodType.Vector:
|
|
|
|
+ {
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].isRerank = Number(
|
|
|
|
+ indexConfig.isRerank,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].rerank =
|
|
|
|
+ indexConfig.rerankTypeId
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].topK = Number(
|
|
|
|
+ indexConfig.topK,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].isScore = Number(
|
|
|
|
+ indexConfig.isScore,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Vector].score = Number(
|
|
|
|
+ indexConfig.score,
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ case SearchMethodType.Global:
|
|
|
|
+ {
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].isRerank = Number(
|
|
|
|
+ indexConfig.isRerank,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].rerank =
|
|
|
|
+ indexConfig.rerankTypeId
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].topK = Number(
|
|
|
|
+ indexConfig.topK,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].isScore = Number(
|
|
|
|
+ indexConfig.isScore,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Global].score = Number(
|
|
|
|
+ indexConfig.score,
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ case SearchMethodType.Mix:
|
|
|
|
+ {
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod =
|
|
|
|
+ indexConfig.weightRerank
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].weight = Number(
|
|
|
|
+ indexConfig.semantics,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].rerank =
|
|
|
|
+ indexConfig.rerankTypeId
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].topK = Number(
|
|
|
|
+ indexConfig.topK,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].isScore = Number(
|
|
|
|
+ indexConfig.isScore,
|
|
|
|
+ )
|
|
|
|
+ state.searchMethod[SearchMethodType.Mix].score = Number(
|
|
|
|
+ indexConfig.score,
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
onMounted(() => {
|
|
onMounted(() => {
|