Mintplex-Labs / anything-llm

The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, and more.
https://anythingllm.com
MIT License
27.62k stars 2.79k forks source link

[DOCS]: Inconsistent API Response for /v1/workspace/{slug} Endpoint #2546

Closed MrSimonC closed 3 weeks ago

MrSimonC commented 4 weeks ago

Description

I've encountered an inconsistency in the API response for the /v1/workspace/{slug} endpoint. According to the example provided in the swagger documentation, the response should be a single workspace object:

{
  "workspace": {
    "id": 79,
    "name": "My workspace",
    "slug": "my-workspace-123",
    "createdAt": "2023-08-17 00:45:03",
    "openAiTemp": null,
    "lastUpdatedAt": "2023-08-17 00:45:03",
    "openAiHistory": 20,
    "openAiPrompt": null,
    "documents": [],
    "threads": []
  }
}

However, in my testing using the API in C# and AI-powered tools to generate client calling code, I've consistently received an array of (one) workspace as the response, regardless of the slug provided.

Reproduction Steps:

  1. Use the /v1/workspace/{slug} endpoint with a valid slug.
  2. Observe the response.

Expected Behavior: A single workspace object, as documented.

Actual Behavior: An array of one workspace.

Environment:

Additional Information: I've created a pull request with a proposed fix for this issue. If considered, it can be merged to update the documentation and ensure consistency in the API response.

Please let me know if this meets your requirements or if you need any further changes!