mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-11-10 21:32:43 +08:00
Fix: disable agent citation, should not show citation files (#20616)
This commit is contained in:
1 parent
3e483eb7b1
commit
108e2bb3a3
1 file changed
+30
-11
+30
-11
@@ -2280,7 +2280,7 @@ func (s *AgentService) buildRunFunc(canvasID string, versionRow *entity.UserCanv
|
||||
attachment = v
|
||||
}
|
||||
}
|
||||
referencePayload := agentRunReferencePayload(state, legacyReference)
|
||||
referencePayload := agentRunReferencePayload(c, state, legacyReference)
|
||||
assistantOutput := terminalCanvasOutput(c, state, workflowOutput, answer, downloads, attachment)
|
||||
// Release any deferred Agent node that was not consumed because the
|
||||
// downstream Message was skipped by an exception/branch path.
|
||||
@@ -2651,20 +2651,39 @@ func buildPersistedAgentDSL(runDSL map[string]any, state *canvas.CanvasState) en
|
||||
return dsl
|
||||
}
|
||||
|
||||
func agentRunReferencePayload(state *canvas.CanvasState, legacyChunks []interface{}) map[string]interface{} {
|
||||
func agentRunReferencePayload(c *canvas.Canvas, state *canvas.CanvasState, legacyChunks []interface{}) map[string]interface{} {
|
||||
var reference map[string]interface{}
|
||||
if state != nil {
|
||||
if reference := state.GetRetrievalReference(); len(reference) > 0 {
|
||||
return reference
|
||||
reference = state.GetRetrievalReference()
|
||||
}
|
||||
if len(reference) == 0 {
|
||||
if len(legacyChunks) == 0 {
|
||||
return nil
|
||||
}
|
||||
reference = map[string]interface{}{
|
||||
"chunks": legacyChunks,
|
||||
"doc_aggs": []interface{}{},
|
||||
"total": len(legacyChunks),
|
||||
}
|
||||
}
|
||||
if len(legacyChunks) == 0 {
|
||||
return nil
|
||||
}
|
||||
return map[string]interface{}{
|
||||
"chunks": legacyChunks,
|
||||
"doc_aggs": []interface{}{},
|
||||
"total": len(legacyChunks),
|
||||
if c != nil && state != nil {
|
||||
snapshot := state.Snapshot()
|
||||
hasAgent, cite := false, false
|
||||
for cpnID, component := range c.Components {
|
||||
if !strings.EqualFold(component.Obj.ComponentName, "Agent") || len(snapshot[cpnID]) == 0 {
|
||||
continue
|
||||
}
|
||||
hasAgent = true
|
||||
if enabled, _ := component.Obj.Params["cite"].(bool); enabled {
|
||||
cite = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if hasAgent && !cite {
|
||||
delete(reference, "doc_aggs")
|
||||
}
|
||||
}
|
||||
return reference
|
||||
}
|
||||
|
||||
func stringifyAgentUserInput(userInput any) string {
|
||||
|
||||
Reference in new issue
Block a user