Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Fix annotation reply settings (#7696)

KVOJJJin693fe912f283
diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx
index 1e65d7a94f4..0f54f5bfc32 100644
--- a/web/app/components/app/annotation/index.tsx
+++ b/web/app/components/app/annotation/index.tsx
@@ -280,7 +280,7 @@ const Annotation: FC<Props> = ({
onSave={async (embeddingModel, score) => {
if (
embeddingModel.embedding_model_name !== annotationConfig?.embedding_model?.embedding_model_name
- && embeddingModel.embedding_provider_name !== annotationConfig?.embedding_model?.embedding_provider_name
+ || embeddingModel.embedding_provider_name !== annotationConfig?.embedding_model?.embedding_provider_name
) {
const { job_id: jobId }: any = await updateAnnotationStatus(appDetail.id, AnnotationEnableStatus.enable, embeddingModel, score)
await ensureJobCompleted(jobId, AnnotationEnableStatus.enable)
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 e49c69e373b..e418a76c344 100644
--- a/web/app/components/app/configuration/toolbox/annotation/config-param.tsx
+++ b/web/app/components/app/configuration/toolbox/annotation/config-param.tsx
@@ -98,7 +98,7 @@ const AnnotationReplyConfig: FC<Props> = ({
let isEmbeddingModelChanged = false
if (
embeddingModel.embedding_model_name !== annotationConfig.embedding_model.embedding_model_name
- && embeddingModel.embedding_provider_name !== annotationConfig.embedding_model.embedding_provider_name
+ || embeddingModel.embedding_provider_name !== annotationConfig.embedding_model.embedding_provider_name
) {
await onEmbeddingChange(embeddingModel)
isEmbeddingModelChanged = true
diff --git a/web/app/components/app/configuration/toolbox/index.tsx b/web/app/components/app/configuration/toolbox/index.tsx
index 488ca86b905..00ea301a42d 100644
--- a/web/app/components/app/configuration/toolbox/index.tsx
+++ b/web/app/components/app/configuration/toolbox/index.tsx
@@ -32,7 +32,7 @@ const Toolbox: FC<ToolboxProps> = ({
)
}
{
- (showAnnotation || true) && (
+ showAnnotation && (
<Annotation
onEmbeddingChange={onEmbeddingChange}
onScoreChange={onScoreChange}
diff --git a/web/app/components/app/log-annotation/index.tsx b/web/app/components/app/log-annotation/index.tsx
index 852e57035c3..e0ace764f0a 100644
--- a/web/app/components/app/log-annotation/index.tsx
+++ b/web/app/components/app/log-annotation/index.tsx
@@ -1,6 +1,6 @@
'use client'
import type { FC } from 'react'
-import React from 'react'
+import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { useRouter } from 'next/navigation'
import cn from '@/utils/classnames'
@@ -23,10 +23,14 @@ const LogAnnotation: FC<Props> = ({
const router = useRouter()
const appDetail = useAppStore(state => state.appDetail)
- const options = [
- { value: PageType.log, text: t('appLog.title') },
- { value: PageType.annotation, text: t('appAnnotation.title') },
- ]
+ const options = useMemo(() => {
+ if (appDetail?.mode === 'completion')
+ return [{ value: PageType.log, text: t('appLog.title') }]
+ return [
+ { value: PageType.log, text: t('appLog.title') },
+ { value: PageType.annotation, text: t('appAnnotation.title') },
+ ]
+ }, [appDetail])
if (!appDetail) {
return (