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(agent app): moderation feature can't work as expected (#16794)

Novice0722beeb0bd7
diff --git a/web/app/components/base/chat/chat/answer/agent-content.tsx b/web/app/components/base/chat/chat/answer/agent-content.tsx
index 6f03c938f10..c20e38c432c 100644
--- a/web/app/components/base/chat/chat/answer/agent-content.tsx
+++ b/web/app/components/base/chat/chat/answer/agent-content.tsx
@@ -11,10 +11,12 @@ import { getProcessedFilesFromResponse } from '@/app/components/base/file-upload
type AgentContentProps = {
item: ChatItem
responding?: boolean
+ content?: string
}
const AgentContent: FC<AgentContentProps> = ({
item,
responding,
+ content,
}) => {
const {
annotation,
@@ -26,7 +28,7 @@ const AgentContent: FC<AgentContentProps> = ({
return (
<div>
- {agent_thoughts?.map((thought, index) => (
+ {content ? <Markdown content={content} /> : agent_thoughts?.map((thought, index) => (
<div key={index} className='px-2 py-1'>
{thought.thought && (
<Markdown content={thought.thought} />
diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx
index 5d9966ff0c9..2625695221c 100644
--- a/web/app/components/base/chat/chat/answer/index.tsx
+++ b/web/app/components/base/chat/chat/answer/index.tsx
@@ -164,10 +164,11 @@ const Answer: FC<AnswerProps> = ({
)
}
{
- hasAgentThoughts && (
+ (hasAgentThoughts || content) && (
<AgentContent
item={item}
responding={responding}
+ content={content}
/>
)
}