Files
zeropost-engine/scripts/test-image-api.js
T
Nik (Claude) a370b8f7d8 feat: Зеро-персонаж, auto-publish, auto-series, channel-stats, fallback covers
- Персонаж Зеро: 23 позы (zeroCharacter.js), скрипты генерации
- Auto-publish статей в TG: multipart upload, кнопки, режим alternating Zero/cover
- Fallback цепочка обложек: aiprimetech gpt-5.5 → Pollinations → local SVG (6 палитр)
- Auto-series: Claude haiku определяет серию для каждой статьи автоматически
- Channel stats: подписчики, история, delta 24h/7d
- Photo-search: Yandex API, профили доменов, Redis лимиты
- Scheduled posts runner: backfill, preview, queue, cancel
- promptBuilder: author_persona Зеро, голос от первого лица
- Fixes: dollar-placeholder bugs в PATCH channels/autogen, listArticles фильтры
- AI model: gpt-5.5 для image generation
2026-06-07 14:03:56 +03:00

29 lines
1.4 KiB
JavaScript

const path = require('path');
process.chdir('/var/www/zeropost-engine');
require('dotenv').config({ path: '/var/www/zeropost-engine/.env' });
const axios = require('axios');
const config = require('/var/www/zeropost-engine/src/config');
(async () => {
const prompt = `A small friendly emerald green geometric mascot character, soft rounded square shape, two simple black dot eyes, small smile, flat vector illustration style, warm off-white background. No text.`;
const wrapped = `Use the image_generation tool to create the following illustration. Do not write any text response, only call the tool.\n\n${prompt}`;
try {
const res = await axios.post(
`${config.ai.baseUrl}/responses`,
{
model: process.env.AI_MODEL_IMAGE_VIA_RESPONSES || 'gpt-5.2',
input: wrapped,
tools: [{ type: 'image_generation' }],
tool_choice: { type: 'image_generation' },
},
{ headers: { Authorization: `Bearer ${config.ai.imageApiKey}` }, timeout: 300_000 }
);
console.log('output types:', (res.data?.output || []).map(o => o.type));
const imgCall = (res.data?.output || []).find(o => o.type === 'image_generation_call');
if (imgCall) console.log('status:', imgCall.status, 'has result:', !!imgCall.result);
else console.log('full:', JSON.stringify(res.data).slice(0, 500));
} catch (e) {
console.error('FAIL:', e.response?.data || e.message);
}
})();