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.

feat(logAndAnn): add control option for question editing feature (#19117)

HyaCinth5088ab5061cb
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx
index 056ce84f1e7..7ce164c01bd 100644
--- a/web/app/components/app/log/list.tsx
+++ b/web/app/components/app/log/list.tsx
@@ -429,6 +429,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
text_to_speech: {
enabled: true,
},
+ questionEditEnable: false,
supportAnnotation: true,
annotation_reply: {
enabled: true,
@@ -484,6 +485,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
text_to_speech: {
enabled: true,
},
+ questionEditEnable: false,
supportAnnotation: true,
annotation_reply: {
enabled: true,
diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx
index 27952fe468a..7c8eb23b1b8 100644
--- a/web/app/components/base/chat/chat/index.tsx
+++ b/web/app/components/base/chat/chat/index.tsx
@@ -265,6 +265,7 @@ const Chat: FC<ChatProps> = ({
item={item}
questionIcon={questionIcon}
theme={themeBuilder?.theme}
+ enableEdit={config?.questionEditEnable}
switchSibling={switchSibling}
/>
)
diff --git a/web/app/components/base/chat/chat/question.tsx b/web/app/components/base/chat/chat/question.tsx
index af4d64964c2..3f7f2e837f2 100644
--- a/web/app/components/base/chat/chat/question.tsx
+++ b/web/app/components/base/chat/chat/question.tsx
@@ -28,6 +28,7 @@ type QuestionProps = {
item: ChatItem
questionIcon?: ReactNode
theme: Theme | null | undefined
+ enableEdit?: boolean
switchSibling?: (siblingMessageId: string) => void
}
@@ -35,6 +36,7 @@ const Question: FC<QuestionProps> = ({
item,
questionIcon,
theme,
+ enableEdit = true,
switchSibling,
}) => {
const { t } = useTranslation()
@@ -87,9 +89,9 @@ const Question: FC<QuestionProps> = ({
}}>
<RiClipboardLine className='h-4 w-4' />
</ActionButton>
- <ActionButton onClick={handleEdit}>
+ {enableEdit && <ActionButton onClick={handleEdit}>
<RiEditLine className='h-4 w-4' />
- </ActionButton>
+ </ActionButton>}
</div>
</div>
<div
diff --git a/web/app/components/base/chat/types.ts b/web/app/components/base/chat/types.ts
index 95e52f084e9..91f9bc976b7 100644
--- a/web/app/components/base/chat/types.ts
+++ b/web/app/components/base/chat/types.ts
@@ -46,6 +46,7 @@ export type EnableType = {
export type ChatConfig = Omit<ModelConfig, 'model'> & {
supportAnnotation?: boolean
appId?: string
+ questionEditEnable?: boolean
supportFeedback?: boolean
supportCitationHitInfo?: boolean
}