Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/server should return better error codes when generating open ai images #582

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

TroyceGowdy
Copy link
Contributor

fixes #565

- Updated AIImageInterfaceResponse to handle both success and failure cases.
- Added error handling in OpenAIImageInterface.ts to check for HTTP 400 Bad Request responses.
- Return a proper response to the user when provided parameters are not accepted by the selected model.
…request'

fix: AIController.ts and AIImageInterface.ts now include a property to handle 'invalid_request'
@TroyceGowdy TroyceGowdy added bug Something isn't working area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) labels Dec 23, 2024
@TroyceGowdy TroyceGowdy self-assigned this Dec 23, 2024
Copy link
Member

@KallynGowdy KallynGowdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple little things I noticed. Everything else looks good.

CHANGELOG.md Outdated
@@ -1,5 +1,17 @@
# CasualOS Changelog

## V3.3.16

#### Date: TBA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TroyceGowdy This should be "TBD" instead of "TBA". Our release script requires a specific format in order to work.

span?.setStatus({ code: SpanStatusCode.ERROR });

console.error(
`[OpenAIChatInterface] [${request.userId}] [generateImage]: Bad request: ${err.response.data.error.message}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TroyceGowdy This log should note "StabilityAIChatIngerface" instead of OpenAI.

fix: StabilityAIImageInterface.ts now returns 'StabilityAIChatIngerface' instead of 'OpenAIChatInterface'
Copy link
Member

@KallynGowdy KallynGowdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TroyceGowdy I just noticed that there are a couple build errors in the unit tests for the AI controller. Could you fix those too?

@KallynGowdy
Copy link
Member

@TroyceGowdy Can you fix the test errors for RecordsServer as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) bug Something isn't working
Projects
Status: To triage
Development

Successfully merging this pull request may close these issues.

The server should return better error codes when generating OpenAI images with unacceptable parameters
2 participants