Throw error on moderation, fix OpenAI config#1802
Merged
KernelDeimos merged 2 commits intomainfrom Oct 22, 2025
Merged
Conversation
I was not able to locate a change causing a configuration regression, however I do know AI was working in my OSS clone and that I had no reason to change my AI configuration in my `local.json` file. In any case, it is clear that configuration was not working as intended. This commit fixes PuterAIModule which was not enabling OpenAI services when `openai` was configured within the `services` block, even though the `services` block configuration is supposed to be the recommended configuration and the global `openai` config object is supposed to be deprecated. This commit also fixes OpenAIImageGenerationService which was not accepting the current parameter name for the API key (`apiKey`) and instead only accepted the legacy key (`secret_key`) which created this interesting problem where using the recommended parameter name would prevent Puter from booting successfully.
Instead of switching to test mode, which responds with "Lorem Ipsum" sample output to test the API, throw an appropriate error message for content moderation failures. This is especially useful when OpenAI's moderation is way way way way too aggressive as this confuses users.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description here would be redundant - see commit messages which are properly detailed: