mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-29 20:19:24 +08:00
fix: failed to set right status in memory (#17472)
As title Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -316,8 +316,8 @@ func (m *MessageComponent) Invoke(ctx context.Context, db *gorm.DB, inputs map[s
|
||||
saveErr := saver.Save(ctx, MemorySaveRequest{
|
||||
MemoryIDs: memIDs,
|
||||
UserID: userID,
|
||||
AgentID: stringFromStateSys(state, "agent_id"),
|
||||
SessionID: state.SessionID,
|
||||
AgentID: memoryAgentID(state),
|
||||
SessionID: memorySessionID(state),
|
||||
UserInput: stringFromStateSys(state, "query"),
|
||||
AgentResponse: rendered,
|
||||
})
|
||||
@@ -330,6 +330,29 @@ func (m *MessageComponent) Invoke(ctx context.Context, db *gorm.DB, inputs map[s
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func memoryAgentID(state *runtime.CanvasState) string {
|
||||
if agentID := stringFromStateSys(state, "agent_id"); agentID != "" {
|
||||
return agentID
|
||||
}
|
||||
if canvasID := stringFromStateSys(state, "canvas_id"); canvasID != "" {
|
||||
return canvasID
|
||||
}
|
||||
if state == nil {
|
||||
return ""
|
||||
}
|
||||
return state.SessionID
|
||||
}
|
||||
|
||||
func memorySessionID(state *runtime.CanvasState) string {
|
||||
if sessionID := stringFromStateSys(state, "session_id"); sessionID != "" {
|
||||
return sessionID
|
||||
}
|
||||
if state == nil {
|
||||
return ""
|
||||
}
|
||||
return state.RunID
|
||||
}
|
||||
|
||||
// resolveDeferredTemplate resolves a Message template while consuming any
|
||||
// lazy Agent stream it references. It returns the complete visible text and a
|
||||
// flag indicating whether a DeferredStream was opened.
|
||||
|
||||
Reference in New Issue
Block a user