Fix ratio in TogetherImage (#2127)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (20.x) (push) Has been cancelled
test / test-backend (22.x) (push) Has been cancelled
test / API tests (node env, api-test) (22.x) (push) Has been cancelled
test / puterjs (node env, vitest) (22.x) (push) Has been cancelled

This commit is contained in:
Neal Shah
2025-12-10 17:56:10 -05:00
committed by GitHub
parent bcd96523cb
commit 6929e48b8e
@@ -18,9 +18,9 @@
*/
// METADATA // {"ai-commented":{"service":"claude"}}
import { Context } from '../../../util/context.js';
import { Together } from 'together-ai';
import { APIError } from 'openai';
import { Together } from 'together-ai';
import { Context } from '../../../util/context.js';
import BaseService from '../../BaseService.js';
import { TypedValue } from '../../drivers/meta/Runtime.js';
@@ -220,9 +220,8 @@ export class TogetherImageGenerationService extends BaseService {
const ratioWidth = (ratio && ratio.w !== undefined) ? Number(ratio.w) : undefined;
const ratioHeight = (ratio && ratio.h !== undefined) ? Number(ratio.h) : undefined;
const normalizedWidth = this.#normalizeDimension(width !== undefined ? Number(width) : (ratioWidth ?? this.constructor.DEFAULT_RATIO.w));
const normalizedHeight = this.#normalizeDimension(height !== undefined ? Number(height) : (ratioHeight ?? this.constructor.DEFAULT_RATIO.h));
const normalizedWidth = this.#normalizeDimension(width !== undefined ? Number(width) : (ratioWidth ?? this.DEFAULT_RATIO.w));
const normalizedHeight = this.#normalizeDimension(height !== undefined ? Number(height) : (ratioHeight ?? this.DEFAULT_RATIO.h));
if ( aspect_ratio ) {
request.aspect_ratio = aspect_ratio;