mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-15 01:18:26 +08:00
Go: fix bugs (#16911)
### Summary 1. Fix 'list users' in admin CLI 2. Change 3 slow test cases priority. Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -217,6 +217,7 @@ func (h *Handler) ListUsers(c *gin.Context) {
|
||||
}
|
||||
|
||||
common.SuccessWithData(c, users, "List users")
|
||||
return
|
||||
case common.EnterpriseEdition:
|
||||
users, err = h.service.ListUsersEE(pageInt, pageSizeInt, name, status, role, sort, orderBy, plan, topInt, daysInt, quotaInt)
|
||||
if err != nil {
|
||||
@@ -227,9 +228,6 @@ func (h *Handler) ListUsers(c *gin.Context) {
|
||||
common.ErrorWithCode(c, common.CodeBadRequest, "Invalid RAGFlow type")
|
||||
return
|
||||
}
|
||||
|
||||
common.SuccessWithData(c, users, "List users")
|
||||
return
|
||||
}
|
||||
|
||||
// CreateUserHTTPRequest create user request
|
||||
|
||||
@@ -1353,6 +1353,13 @@ func (s *Service) checkTaskExecutorAlive(name string) (map[string]interface{}, e
|
||||
func (s *Service) checkNatsAlive(name string, ip string, port int) (map[string]interface{}, error) {
|
||||
|
||||
msgQueueEngine := engine.GetMessageQueueEngine()
|
||||
if msgQueueEngine == nil {
|
||||
return map[string]interface{}{
|
||||
"service_name": name,
|
||||
"status": "Message queue engine not initialized",
|
||||
}, nil
|
||||
}
|
||||
|
||||
status := msgQueueEngine.CheckStatus()
|
||||
|
||||
return map[string]interface{}{
|
||||
|
||||
@@ -1762,7 +1762,7 @@ func (c *CLI) AdminListUsersCommand(cmd *Command) (ResponseIf, error) {
|
||||
|
||||
var result CommonResponse
|
||||
if err = json.Unmarshal(resp.Body, &result); err != nil {
|
||||
return nil, fmt.Errorf("list users failed: invalid JSON (%w)", err)
|
||||
return nil, fmt.Errorf("list users failed: invalid JSON (%w), body: %s", err, string(resp.Body))
|
||||
}
|
||||
|
||||
if result.Code != 0 {
|
||||
|
||||
@@ -319,7 +319,7 @@ def test_retrieval_kb_not_found(monkeypatch):
|
||||
assert "Knowledgebase not found" in res["message"], res
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_not_found_exception_mapping(monkeypatch):
|
||||
module = _load_dify_retrieval_module(monkeypatch)
|
||||
_set_request_json(monkeypatch, module, {"knowledge_id": "kb-1", "query": "hello"})
|
||||
|
||||
@@ -219,7 +219,7 @@ def test_openai_compatible_stream_shape_and_done_semantics(rest_client, create_c
|
||||
assert any(evt.get("choices", [{}])[0].get("finish_reason") == "stop" for evt in json_events), json_events
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_openai_compatible_reference_metadata_fields_filter_accepts_array(rest_client, create_chat):
|
||||
chat_id = create_chat("restful_openai_reference_fields_array_chat")
|
||||
res = rest_client.post(
|
||||
|
||||
@@ -327,7 +327,7 @@ def test_retrieval_kb_not_found(monkeypatch):
|
||||
assert "Knowledgebase not found" in res["message"], res
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_not_found_exception_mapping(monkeypatch):
|
||||
module = _load_dify_retrieval_module(monkeypatch)
|
||||
_set_request_json(monkeypatch, module, {"knowledge_id": "kb-1", "query": "hello"})
|
||||
|
||||
Reference in New Issue
Block a user