(c *gin.Context, eid int64, userID int64, modelStr string, conversationIDValue interface{})
| 221 | } |
| 222 | |
| 223 | func handleRelayConversationID(c *gin.Context, eid int64, userID int64, modelStr string, conversationIDValue interface{}) bool { |
| 224 | if strings.HasPrefix(modelStr, "agent-") { |
| 225 | parts := strings.Split(modelStr, "-") |
| 226 | if len(parts) == 3 { |
| 227 | agentID, err1 := resolveAgentModelID(parts[1]) |
| 228 | agentModelID, err2 := resolveAgentModelID(parts[2]) |
| 229 | if err1 == nil && err2 == nil { |
| 230 | if agent, err := model.GetAgentByID(eid, agentID); err == nil { |
| 231 | if agentModel, err := model.GetAgentModelByID(eid, agentModelID); err == nil && |
| 232 | agentModel.Eid == eid && agentModel.AgentID == agentID { |
| 233 | agent.ChannelType = agentModel.ChannelType |
| 234 | agent.Model = agentModel.Model |
| 235 | agent.SpecificChannelID = agentModel.ChannelID |
| 236 | return handleRelayConversationIDForAgent(c, eid, userID, agent, conversationIDValue) |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } else if len(parts) == 2 { |
| 241 | agentID, err := resolveAgentModelID(parts[1]) |
| 242 | if err == nil { |
| 243 | if agent, err := model.GetAgentByID(eid, agentID); err == nil { |
| 244 | return handleRelayConversationIDForAgent(c, eid, userID, agent, conversationIDValue) |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | return handlePlatformConversationID(c, eid, userID, conversationIDValue) |
| 250 | } |
| 251 | |
| 252 | func handleRelayConversationIDForAgent(c *gin.Context, eid int64, userID int64, agent *model.Agent, conversationIDValue interface{}) bool { |
| 253 | if agent != nil && agent.IsOpenClawWSCompatible() { |
nothing calls this directly
no test coverage detected