mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-26 01:52:16 +08:00
fix(agent): keep think tags in persisted agent session messages (#18222)
This commit is contained in:
@@ -1395,6 +1395,14 @@ func (h *AgentHandler) AgentChatCompletions(c *gin.Context) {
|
||||
if c, ok := evData["content"].(string); ok {
|
||||
fullContent += c
|
||||
}
|
||||
// Mirror Python agent_api.py: the reasoning segment stays
|
||||
// wrapped in <think> tags in the aggregated answer so the
|
||||
// chat UI can render the "thought" section.
|
||||
if st, _ := evData["start_to_think"].(bool); st {
|
||||
fullContent += "<think>"
|
||||
} else if et, _ := evData["end_to_think"].(bool); et {
|
||||
fullContent += "</think>"
|
||||
}
|
||||
}
|
||||
if ref, _ := evData["reference"].(map[string]any); ref != nil {
|
||||
for k, v := range ref {
|
||||
|
||||
Reference in New Issue
Block a user