| 1234567891011121314151617181920212223242526272829 |
- const config = require('../config');
- const PATH = 'images/generations';
- const TIMEOUT_MS = 180000;
- // 普通 AI 请求参数
- function getBody(prompt, outputPath) {
- return {
- model: 'dall-e-2',
- prompt,
- n: 1,
- size: '1024x1024',
- response_format: outputPath ? 'b64_json' : 'url'
- };
- }
- // 豆包文生图请求参数(优先用 DOUBAO_IMAGE_MODEL,未配置则用 DOUBAO_MODEL)
- function getDoubaoBody(prompt, outputPath) {
- const model = (config.DOUBAO_IMAGE_MODEL && config.DOUBAO_IMAGE_MODEL.trim()) ? config.DOUBAO_IMAGE_MODEL.trim() : config.DOUBAO_MODEL;
- return {
- model,
- prompt,
- n: 1,
- size: '1024x1024',
- response_format: outputPath ? 'b64_json' : 'url'
- };
- }
- module.exports = { path: PATH, getBody, getDoubaoBody, timeoutMs: TIMEOUT_MS };
|