feat: Add DALL-E reverse proxy settings and handle errors in image generation (#1173)

* feat: Add DALL-E reverse proxy settings and handle errors in image generation

* fix(ci): avoid importing extra utilities
This commit is contained in:
Danny Avila 2023-11-13 11:05:59 -05:00 committed by GitHub
parent 25402fd208
commit c7205c9bb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 23 deletions

View file

@ -134,15 +134,6 @@ describe('DALLE3', () => {
await expect(dalle._call(mockData)).rejects.toThrow('Missing required field: prompt');
});
it('should throw an error if no image URL is returned from OpenAI API', async () => {
const mockData = {
prompt: 'A test prompt',
};
// Simulate a response with an object that has a `url` property set to `undefined`
generate.mockResolvedValue({ data: [{ url: undefined }] });
await expect(dalle._call(mockData)).rejects.toThrow('No image URL returned from OpenAI API.');
});
it('should log to console if no image name is found in the URL', async () => {
const mockData = {
prompt: 'A test prompt',