Lumen & Gesso / website · lumengesso.com / app / lib / revision-framing.ts
| 1 | import 'server-only'; |
| 2 | import { encodeMirroredFraming } from './image-processing'; |
| 3 | |
| 4 | export function requestsWiderFraming(feedback: string): boolean { |
| 5 | const pullback = /\b(?:zoom(?:ing)? out|wider (?:crop|framing|shot)|pull (?:the camera )?back|(?:pull|push|move)\s+(?:(?:the|my|our)\s+)?(?:cat|dog|pet|subject|him|her|them|camera)\s+(?:farther\s+|further\s+)?(?:back|away))\b/i; |
| 6 | return feedback.split(/[.!?;,\n]|\bbut\b/i).some(clause => { |
| 7 | const match = pullback.exec(clause); |
| 8 | if (!match) return false; |
| 9 | return !/\b(?:no|not|never|don['’]t|without|avoid)\b/i.test(clause.slice(0, match.index)); |
| 10 | }); |
| 11 | } |
| 12 | |
| 13 | export async function prepareWiderFraming(bytes: Buffer): Promise<Buffer> { |
| 14 | return encodeMirroredFraming(bytes); |
| 15 | } |