const { runWithModel } = require('./shared') async function executeText2text ({ prompt, model, folderPath }) { const p = prompt != null ? String(prompt).trim() : '' try { const result = await runWithModel('text2text', 'doubao_text2text', [p], model) if (!result.success) return { success: false, error: result.error || 'text2text 失败' } const data = result.data const text = data?.choices?.[0]?.message?.content ?? data?.choices?.[0]?.text ?? '' return { success: true, value: typeof text === 'string' ? text : String(text) } } catch (e) { return { success: false, error: (e && (e.message || String(e))) || 'text2text 异常' } } } module.exports = { executeText2text }