Open MrSimonC opened 4 days ago
In the interim, openAiHistory
should be any non-zero number - 20 is the default. This is the amount of chat history included in a chat response.
Wrt this issue, each writable
field should have some conditional form of validation - which was omitted historically to prevent non-writable fields from being edited via the Workspace.update
method.
How are you running AnythingLLM?
Docker (remote machine)
What happened?
When calling the endpoint
/v1/workspace/{slug}/update
with a POST request and the following payload:the endpoint incorrectly returns a
200
status code with the following message:The response indicates an error in the
prisma.workspaces.update()
invocation due to theopenAiHistory
field beingnull
, which is not allowed.Additional Information: This issue leads to confusion as the status code
200 OK
suggests that the operation was successful, while the message indicates an error. Proper error handling is required to ensure the API behaves as expected.Suggested Fix:
openAiHistory
isnull
and not allowed, return a400 Bad Request
status code with a clear error message.null
values for fields wherenull
is not allowed, and proceed with updating the other valid fields.Are there known steps to reproduce?
Expected Behavior:
400 Bad Request
) if theopenAiHistory
field isnull
and cannot be processed.null
value foropenAiHistory
and update the workspace with the provided valid fields, returning a200
status code only if the operation is successful.Steps to Reproduce:
/v1/workspace/{slug}/update
with the following payload:Actual Response:
200 OK