mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-18 09:05:55 +08:00
fix: annotation id not pass to update setting (#5429)
This commit is contained in:
parent
23fa3dedc4
commit
3db110c0b9
@ -41,6 +41,7 @@ const Annotation: FC<Props> = ({
|
|||||||
const fetchAnnotationConfig = async () => {
|
const fetchAnnotationConfig = async () => {
|
||||||
const res = await doFetchAnnotationConfig(appDetail.id)
|
const res = await doFetchAnnotationConfig(appDetail.id)
|
||||||
setAnnotationConfig(res as AnnotationReplyConfig)
|
setAnnotationConfig(res as AnnotationReplyConfig)
|
||||||
|
return (res as AnnotationReplyConfig).id
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isChatApp = appDetail.mode !== 'completion'
|
const isChatApp = appDetail.mode !== 'completion'
|
||||||
@ -284,9 +285,9 @@ const Annotation: FC<Props> = ({
|
|||||||
const { job_id: jobId }: any = await updateAnnotationStatus(appDetail.id, AnnotationEnableStatus.enable, embeddingModel, score)
|
const { job_id: jobId }: any = await updateAnnotationStatus(appDetail.id, AnnotationEnableStatus.enable, embeddingModel, score)
|
||||||
await ensureJobCompleted(jobId, AnnotationEnableStatus.enable)
|
await ensureJobCompleted(jobId, AnnotationEnableStatus.enable)
|
||||||
}
|
}
|
||||||
|
const annotationId = await fetchAnnotationConfig()
|
||||||
if (score !== annotationConfig?.score_threshold)
|
if (score !== annotationConfig?.score_threshold)
|
||||||
await updateAnnotationScore(appDetail.id, annotationConfig?.id || '', score)
|
await updateAnnotationScore(appDetail.id, annotationId, score)
|
||||||
|
|
||||||
await fetchAnnotationConfig()
|
await fetchAnnotationConfig()
|
||||||
Toast.notify({
|
Toast.notify({
|
||||||
|
@ -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 { LinkExternal02, Settings04 } from '@/app/components/base/icons/src/vender/line/general'
|
||||||
import ConfigContext from '@/context/debug-configuration'
|
import ConfigContext from '@/context/debug-configuration'
|
||||||
import type { EmbeddingModelConfig } from '@/app/components/app/annotation/type'
|
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 = {
|
type Props = {
|
||||||
onEmbeddingChange: (embeddingModel: EmbeddingModelConfig) => void
|
onEmbeddingChange: (embeddingModel: EmbeddingModelConfig) => void
|
||||||
@ -98,6 +99,7 @@ const AnnotationReplyConfig: FC<Props> = ({
|
|||||||
setIsShowEdit(false)
|
setIsShowEdit(false)
|
||||||
}}
|
}}
|
||||||
onSave={async (embeddingModel, score) => {
|
onSave={async (embeddingModel, score) => {
|
||||||
|
const annotationConfig = await fetchAnnotationConfig(appId) as AnnotationReplyConfigType
|
||||||
let isEmbeddingModelChanged = false
|
let isEmbeddingModelChanged = false
|
||||||
if (
|
if (
|
||||||
embeddingModel.embedding_model_name !== annotationConfig.embedding_model.embedding_model_name
|
embeddingModel.embedding_model_name !== annotationConfig.embedding_model.embedding_model_name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user