Branchwell

Lumen & Gesso / website · lumengesso.com / app / lib / revision-framing.ts

1import 'server-only';
2import { encodeMirroredFraming } from './image-processing';
3
4export 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
13export async function prepareWiderFraming(bytes: Buffer): Promise<Buffer> {
14 return encodeMirroredFraming(bytes);
15}