fix: Allow azure assistants chats to be deleted #3893
+14
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Deletion of an assitants chat with azureAssistants through the left sidebar will crash the application with the following error.
This happen as the assistant chat is detected as a conversation with an assitant endpoint with a dedicated delete API call.
But there exists no detection which assitant endpoint (Azure or OpenAI) is used. Therefore if Azure is used and no OpenAI API key is configured the application still tries to delete the conversation through an API call with OpenAI and then crash.
I added an optional endpoint property to the delete mutation to pass along the desired endpoint.
Change Type
Please delete any irrelevant options.
Testing
Build the latest docker image from main. Start the application with an azure assistant endpoint and plugin configured. Do not provide a OpenAI API key. Start a chat with the assistant after the response delete the conversation through the left sidebar. Observe the application crashing.
Apply suggested changes and repeat the previous steps. Observe no crashes, errors or warnings. The chat is is deleted. Start a normal chat without assistant and delete it aswell. Again no warnings etc.
Checklist
Please delete any irrelevant options.
My code adheres to this project's style guidelines
I have performed a self-review of my own code
My changes do not introduce new warnings
Any changes dependent on mine have been merged and published in downstream modules.
Local unit tests pass with my changes
npm run test:api
did not pass on the upstream main as I seem to miss some configuration. Therefore I could not validate those tests running