mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Use API model info to decide how to generate image instead of hardcoding provider ID
This commit is contained in:
3 files changed
+24
-7
No files matched your search
@@ -21,6 +21,7 @@ export class GenerateImageTool implements Tool<GenerateImageParams> {
|
||||
private tmpPath: string,
|
||||
private provider: AIProvider,
|
||||
private model: string,
|
||||
private outputModalities: string[] | undefined,
|
||||
private user?: NUser,
|
||||
private corsProxy?: string,
|
||||
) {}
|
||||
@@ -34,8 +35,10 @@ export class GenerateImageTool implements Tool<GenerateImageParams> {
|
||||
let imageData: Uint8Array;
|
||||
let extension = 'png';
|
||||
|
||||
// OpenRouter uses chat completions with modalities
|
||||
if (this.provider.id === 'openrouter') {
|
||||
// Check if the model supports image output modality (chat completions path)
|
||||
const supportsImageOutput = this.outputModalities?.includes('image');
|
||||
|
||||
if (supportsImageOutput) {
|
||||
const response = await client.chat.completions.create({
|
||||
model: this.model,
|
||||
messages: [
|
||||
|
||||
Reference in new issue
Block a user