|
@@ -5,8 +5,8 @@
|
|
|
<div
|
|
|
class="__hover h-[8.38rem] flex-1 rounded-[var(--czr-gap)] bg-[#ffffff] px-[1.5rem] py-[1rem]"
|
|
|
style="border: var(--czr-border); border-width: 0.13rem"
|
|
|
- :class="{ 'index-method-active': state.indexMethod.value === 1 }"
|
|
|
- @click="state.indexMethod.value = 1"
|
|
|
+ :class="{ 'index-method-active': state.indexMethod.value === '高质量' }"
|
|
|
+ @click="() => (state.indexMethod.value = '高质量')"
|
|
|
>
|
|
|
<div class="flex items-center">
|
|
|
<img
|
|
@@ -26,29 +26,29 @@
|
|
|
调用嵌入模型来处理文档以实现更精确的检索,可以帮助大语言模型生成高质量的回答。
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="__hover h-[8.38rem] flex-1 rounded-[var(--czr-gap)] bg-[#ffffff] px-[1.5rem] py-[1rem]"
|
|
|
- style="border: var(--czr-border); border-width: 0.13rem"
|
|
|
- :class="{ 'index-method-active': state.indexMethod.value === 2 }"
|
|
|
- @click="state.indexMethod.value = 2"
|
|
|
- >
|
|
|
- <div class="flex items-center">
|
|
|
- <img
|
|
|
- src="@/assets/images/model-icon-2.png"
|
|
|
- class="mr-[var(--czr-gap)] h-[3.25rem] w-[3.25rem]"
|
|
|
- />
|
|
|
- <div class="text-[1.25rem] font-bold text-[#2E3238]">经济</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="mt-[0.5rem] text-[0.88rem] text-[#606266]"
|
|
|
- style="line-height: 1.3rem"
|
|
|
- >
|
|
|
- 每个块使用 10 个关键词进行检索,不消耗 tokens,但会降低检索准确性。
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <!-- <div-->
|
|
|
+ <!-- class="__hover h-[8.38rem] flex-1 rounded-[var(--czr-gap)] bg-[#ffffff] px-[1.5rem] py-[1rem]"-->
|
|
|
+ <!-- style="border: var(--czr-border); border-width: 0.13rem"-->
|
|
|
+ <!-- :class="{ 'index-method-active': state.indexMethod.value === 2 }"-->
|
|
|
+ <!-- @click="() => state.indexMethod.value = 2"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <div class="flex items-center">-->
|
|
|
+ <!-- <img-->
|
|
|
+ <!-- src="@/assets/images/model-icon-2.png"-->
|
|
|
+ <!-- class="mr-[var(--czr-gap)] h-[3.25rem] w-[3.25rem]"-->
|
|
|
+ <!-- />-->
|
|
|
+ <!-- <div class="text-[1.25rem] font-bold text-[#2E3238]">经济</div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div-->
|
|
|
+ <!-- class="mt-[0.5rem] text-[0.88rem] text-[#606266]"-->
|
|
|
+ <!-- style="line-height: 1.3rem"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- 每个块使用 10 个关键词进行检索,不消耗 tokens,但会降低检索准确性。-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
</div>
|
|
|
<div
|
|
|
- v-if="state.indexMethod.value === 1"
|
|
|
+ v-if="state.indexMethod.value === '高质量'"
|
|
|
class="mt-[var(--czr-gap)] flex h-[2.5rem] w-full items-center gap-[0.5rem] rounded-[0.25rem] px-[0.75rem] text-[0.8rem] text-[#666666]"
|
|
|
style="
|
|
|
border: var(--czr-border);
|
|
@@ -83,7 +83,7 @@
|
|
|
'search-method-active':
|
|
|
state.searchMethod.value === SearchMethodType.Vector,
|
|
|
}"
|
|
|
- @click="state.searchMethod.value = SearchMethodType.Vector"
|
|
|
+ @click="() => (state.searchMethod.value = SearchMethodType.Vector)"
|
|
|
>
|
|
|
<div class="h-full w-full px-[1.5rem] py-[1rem]">
|
|
|
<div class="flex items-center">
|
|
@@ -194,7 +194,7 @@
|
|
|
'search-method-active':
|
|
|
state.searchMethod.value === SearchMethodType.Global,
|
|
|
}"
|
|
|
- @click="state.searchMethod.value = SearchMethodType.Global"
|
|
|
+ @click="() => (state.searchMethod.value = SearchMethodType.Global)"
|
|
|
>
|
|
|
<div class="h-full w-full px-[1.5rem] py-[1rem]">
|
|
|
<div class="flex items-center">
|
|
@@ -308,7 +308,7 @@
|
|
|
'search-method-active':
|
|
|
state.searchMethod.value === SearchMethodType.Mix,
|
|
|
}"
|
|
|
- @click="state.searchMethod.value = SearchMethodType.Mix"
|
|
|
+ @click="() => (state.searchMethod.value = SearchMethodType.Mix)"
|
|
|
>
|
|
|
<div class="h-full w-full px-[1.5rem] py-[1rem]">
|
|
|
<div class="flex items-center">
|
|
@@ -335,9 +335,14 @@
|
|
|
style="border: var(--czr-border); border-width: 0.13rem"
|
|
|
:class="{
|
|
|
'index-method-active':
|
|
|
- state.searchMethod[SearchMethodType.Mix].indexMethod === 1,
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod ===
|
|
|
+ 'weightSetting',
|
|
|
}"
|
|
|
- @click="state.searchMethod[SearchMethodType.Mix].indexMethod = 1"
|
|
|
+ @click="
|
|
|
+ () =>
|
|
|
+ (state.searchMethod[SearchMethodType.Mix].indexMethod =
|
|
|
+ 'weightSetting')
|
|
|
+ "
|
|
|
>
|
|
|
<div class="flex items-center">
|
|
|
<img
|
|
@@ -364,9 +369,14 @@
|
|
|
style="border: var(--czr-border); border-width: 0.13rem"
|
|
|
:class="{
|
|
|
'index-method-active':
|
|
|
- state.searchMethod[SearchMethodType.Mix].indexMethod === 2,
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod ===
|
|
|
+ 'rerank',
|
|
|
}"
|
|
|
- @click="state.searchMethod[SearchMethodType.Mix].indexMethod = 2"
|
|
|
+ @click="
|
|
|
+ () =>
|
|
|
+ (state.searchMethod[SearchMethodType.Mix].indexMethod =
|
|
|
+ 'rerank')
|
|
|
+ "
|
|
|
>
|
|
|
<div class="flex items-center">
|
|
|
<img
|
|
@@ -389,7 +399,10 @@
|
|
|
class="mt-[1rem] flex flex-col gap-[0.5rem] rounded-[0.25rem] bg-[#ffffff] p-[var(--czr-gap)] text-[1rem] font-bold text-[#2E3238]"
|
|
|
>
|
|
|
<template
|
|
|
- v-if="state.searchMethod[SearchMethodType.Mix].indexMethod === 1"
|
|
|
+ v-if="
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod ===
|
|
|
+ 'weightSetting'
|
|
|
+ "
|
|
|
>
|
|
|
<div>
|
|
|
<el-slider
|
|
@@ -416,7 +429,8 @@
|
|
|
</template>
|
|
|
<template
|
|
|
v-else-if="
|
|
|
- state.searchMethod[SearchMethodType.Mix].indexMethod === 2
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod ===
|
|
|
+ 'rerank'
|
|
|
"
|
|
|
>
|
|
|
<CzrFormColumn
|
|
@@ -494,14 +508,12 @@
|
|
|
import { getCurrentInstance, reactive, ref, watch } from 'vue'
|
|
|
|
|
|
const emit = defineEmits([])
|
|
|
-const props = defineProps({
|
|
|
- transfer: <any>{},
|
|
|
-})
|
|
|
+const props = defineProps({})
|
|
|
const { proxy }: any = getCurrentInstance()
|
|
|
enum SearchMethodType {
|
|
|
- Vector = 'vector',
|
|
|
- Global = 'global',
|
|
|
- Mix = 'mix',
|
|
|
+ Vector = 'VECTOR',
|
|
|
+ Global = 'FULL_TEXT',
|
|
|
+ Mix = 'HYBRID',
|
|
|
}
|
|
|
const state: any = reactive({
|
|
|
indexMethod: {
|
|
@@ -530,7 +542,6 @@ const state: any = reactive({
|
|
|
score: 0.5,
|
|
|
},
|
|
|
mix: {
|
|
|
- isRerank: true,
|
|
|
indexMethod: 1,
|
|
|
weight: 0.7,
|
|
|
rerank: '',
|
|
@@ -540,15 +551,159 @@ const state: any = reactive({
|
|
|
},
|
|
|
},
|
|
|
})
|
|
|
-watch(
|
|
|
- () => props.transfer,
|
|
|
- (n) => {
|
|
|
- if (n) {
|
|
|
- // 初始化
|
|
|
- }
|
|
|
- },
|
|
|
- { immediate: true },
|
|
|
-)
|
|
|
+const reset = () => {
|
|
|
+ state.indexMethod = {
|
|
|
+ show: true,
|
|
|
+ value: 1,
|
|
|
+ }
|
|
|
+ state.embedding = {
|
|
|
+ show: true,
|
|
|
+ value: '',
|
|
|
+ }
|
|
|
+ state.searchMethod = {
|
|
|
+ show: true,
|
|
|
+ value: SearchMethodType.Vector,
|
|
|
+ [SearchMethodType.Vector]: {
|
|
|
+ isRerank: true,
|
|
|
+ rerank: '',
|
|
|
+ topK: 5,
|
|
|
+ isScore: true,
|
|
|
+ score: 0.5,
|
|
|
+ },
|
|
|
+ [SearchMethodType.Global]: {
|
|
|
+ isRerank: true,
|
|
|
+ rerank: '',
|
|
|
+ topK: 5,
|
|
|
+ isScore: true,
|
|
|
+ score: 0.5,
|
|
|
+ },
|
|
|
+ [SearchMethodType.Mix]: {
|
|
|
+ indexMethod: 1,
|
|
|
+ weight: 0.7,
|
|
|
+ rerank: '',
|
|
|
+ topK: 5,
|
|
|
+ isScore: true,
|
|
|
+ score: 0.5,
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+const getData = () => {
|
|
|
+ const result = {
|
|
|
+ indexingTechnique: state.indexMethod.value,
|
|
|
+ embeddingModelId: state.embedding.value,
|
|
|
+ indexConfig: {},
|
|
|
+ }
|
|
|
+ switch (state.searchMethod.value) {
|
|
|
+ case SearchMethodType.Vector:
|
|
|
+ {
|
|
|
+ result.indexConfig.isRerank = state.searchMethod[
|
|
|
+ SearchMethodType.Vector
|
|
|
+ ].isRerank
|
|
|
+ ? 1
|
|
|
+ : 0
|
|
|
+ result.indexConfig.rerankType =
|
|
|
+ state.searchMethod[SearchMethodType.Vector].rerank
|
|
|
+ result.indexConfig.topK =
|
|
|
+ state.searchMethod[SearchMethodType.Vector].topK
|
|
|
+ result.indexConfig.isScore = state.searchMethod[SearchMethodType.Vector]
|
|
|
+ .isScore
|
|
|
+ ? 1
|
|
|
+ : 0
|
|
|
+ result.indexConfig.score =
|
|
|
+ state.searchMethod[SearchMethodType.Vector].score
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case SearchMethodType.Global:
|
|
|
+ {
|
|
|
+ result.indexConfig.isRerank = state.searchMethod[
|
|
|
+ SearchMethodType.Global
|
|
|
+ ].isRerank
|
|
|
+ ? 1
|
|
|
+ : 0
|
|
|
+ result.indexConfig.rerankType =
|
|
|
+ state.searchMethod[SearchMethodType.Global].rerank
|
|
|
+ result.indexConfig.topK =
|
|
|
+ state.searchMethod[SearchMethodType.Global].topK
|
|
|
+ result.indexConfig.isScore = state.searchMethod[SearchMethodType.Global]
|
|
|
+ .isScore
|
|
|
+ ? 1
|
|
|
+ : 0
|
|
|
+ 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.rerankType =
|
|
|
+ state.searchMethod[SearchMethodType.Mix].rerank
|
|
|
+ result.indexConfig.topK = state.searchMethod[SearchMethodType.Mix].topK
|
|
|
+ result.indexConfig.isScore = state.searchMethod[SearchMethodType.Mix]
|
|
|
+ .isScore
|
|
|
+ ? 1
|
|
|
+ : 0
|
|
|
+ result.indexConfig.score =
|
|
|
+ state.searchMethod[SearchMethodType.Mix].score
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return result
|
|
|
+}
|
|
|
+const init = ({ indexMethod, embedding, searchMethod }) => {
|
|
|
+ state.indexMethod.value = indexMethod
|
|
|
+ state.embedding.value = embedding
|
|
|
+ switch (searchMethod.type) {
|
|
|
+ case SearchMethodType.Vector:
|
|
|
+ {
|
|
|
+ state.searchMethod[SearchMethodType.Vector].isRerank =
|
|
|
+ searchMethod.isRerank == 1
|
|
|
+ state.searchMethod[SearchMethodType.Vector].rerank =
|
|
|
+ searchMethod.rerankType
|
|
|
+ state.searchMethod[SearchMethodType.Vector].topK = searchMethod.topK
|
|
|
+ state.searchMethod[SearchMethodType.Vector].isScore =
|
|
|
+ searchMethod.isScore == 1
|
|
|
+ state.searchMethod[SearchMethodType.Vector].score = searchMethod.score
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case SearchMethodType.Global:
|
|
|
+ {
|
|
|
+ state.searchMethod[SearchMethodType.Global].isRerank =
|
|
|
+ searchMethod.isRerank == 1
|
|
|
+ state.searchMethod[SearchMethodType.Global].rerank =
|
|
|
+ searchMethod.rerankType
|
|
|
+ state.searchMethod[SearchMethodType.Global].topK = searchMethod.topK
|
|
|
+ state.searchMethod[SearchMethodType.Global].isScore =
|
|
|
+ searchMethod.isScore == 1
|
|
|
+ state.searchMethod[SearchMethodType.Global].score = searchMethod.score
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case SearchMethodType.Mix:
|
|
|
+ {
|
|
|
+ state.searchMethod[SearchMethodType.Mix].indexMethod =
|
|
|
+ searchMethod.weightRerank
|
|
|
+ state.searchMethod[SearchMethodType.Mix].weight = Number(
|
|
|
+ searchMethod.semantics,
|
|
|
+ )
|
|
|
+ state.searchMethod[SearchMethodType.Mix].rerank =
|
|
|
+ searchMethod.rerankType
|
|
|
+ state.searchMethod[SearchMethodType.Mix].topK = searchMethod.topK
|
|
|
+ state.searchMethod[SearchMethodType.Mix].isScore =
|
|
|
+ searchMethod.isScore == 1
|
|
|
+ state.searchMethod[SearchMethodType.Mix].score = searchMethod.score
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+}
|
|
|
+defineExpose({
|
|
|
+ reset,
|
|
|
+ getData,
|
|
|
+ init,
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|