兼容新的mongo方法格式,并且修复client的apitoken覆盖问题
This commit is contained in:
@@ -90,6 +90,11 @@ func (c *Client) CreateSession(ctx context.Context, chatId string, req *CreateSe
|
||||
if res.Code != 0 {
|
||||
return nil, gerror.Newf("create session failed: %s", res.Msg)
|
||||
}
|
||||
// 检查响应数据是否为空:防止RAGFlow API返回 {"code":0, "data":null}
|
||||
// 如果不检查直接返回,调用方会收到 (nil, nil),导致空指针异常
|
||||
if res.Data == nil {
|
||||
return nil, gerror.Newf("create session returned null data: %s", res.Msg)
|
||||
}
|
||||
return res.Data, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user