diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index 8d808befaf..8294ae8b26 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -41,6 +41,7 @@ const Annotation: FC = ({ const fetchAnnotationConfig = async () => { const res = await doFetchAnnotationConfig(appDetail.id) setAnnotationConfig(res as AnnotationReplyConfig) + return (res as AnnotationReplyConfig).id } useEffect(() => { const isChatApp = appDetail.mode !== 'completion' @@ -284,9 +285,9 @@ const Annotation: FC = ({ const { job_id: jobId }: any = await updateAnnotationStatus(appDetail.id, AnnotationEnableStatus.enable, embeddingModel, score) await ensureJobCompleted(jobId, AnnotationEnableStatus.enable) } - + const annotationId = await fetchAnnotationConfig() if (score !== annotationConfig?.score_threshold) - await updateAnnotationScore(appDetail.id, annotationConfig?.id || '', score) + await updateAnnotationScore(appDetail.id, annotationId, score) await fetchAnnotationConfig() Toast.notify({ diff --git a/web/app/components/app/configuration/toolbox/annotation/config-param.tsx b/web/app/components/app/configuration/toolbox/annotation/config-param.tsx index 65837cc44d..1742e58682 100644 --- a/web/app/components/app/configuration/toolbox/annotation/config-param.tsx +++ b/web/app/components/app/configuration/toolbox/annotation/config-param.tsx @@ -14,7 +14,8 @@ import TooltipPlus from '@/app/components/base/tooltip-plus' import { LinkExternal02, Settings04 } from '@/app/components/base/icons/src/vender/line/general' import ConfigContext from '@/context/debug-configuration' import type { EmbeddingModelConfig } from '@/app/components/app/annotation/type' -import { updateAnnotationScore } from '@/service/annotation' +import { fetchAnnotationConfig, updateAnnotationScore } from '@/service/annotation' +import type { AnnotationReplyConfig as AnnotationReplyConfigType } from '@/models/debug' type Props = { onEmbeddingChange: (embeddingModel: EmbeddingModelConfig) => void @@ -98,6 +99,7 @@ const AnnotationReplyConfig: FC = ({ setIsShowEdit(false) }} onSave={async (embeddingModel, score) => { + const annotationConfig = await fetchAnnotationConfig(appId) as AnnotationReplyConfigType let isEmbeddingModelChanged = false if ( embeddingModel.embedding_model_name !== annotationConfig.embedding_model.embedding_model_name