diff --git a/README.md b/README.md index 3a87de40..458d01bd 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,9 @@ _⚠️ READ BEFORE PROCEEDING_ - Setup usage limits to avoid unexpected charges (_recommended_) 2. Add rate limiting (_recommended_) - As an additional precaution, create a [Vercel KV](https://vercel.com/docs/storage/vercel-kv/quickstart#create-a-kv-database) store and link it to your project in order to enable rate limiting +3. Configure auto-generated fields (optional) + - Set which text fields should auto-generate when uploading a photo by storing a comma-separated list, e.g., `AI_TEXT_AUTO_GENERATED_FIELDS = title, semantic` + - Accepted values: title, caption, tags, description, all, or none (default is "all") ### 8. Optional configuration diff --git a/src/app/admin/uploads/[uploadPath]/page.tsx b/src/app/admin/uploads/[uploadPath]/page.tsx index 9cf664ab..a2faee67 100644 --- a/src/app/admin/uploads/[uploadPath]/page.tsx +++ b/src/app/admin/uploads/[uploadPath]/page.tsx @@ -3,7 +3,10 @@ import { extractExifDataFromBlobPath } from '@/photo/server'; import { redirect } from 'next/navigation'; import { getUniqueTagsCached } from '@/photo/cache'; import UploadPageClient from '@/photo/UploadPageClient'; -import { AI_TEXT_GENERATION_ENABLED } from '@/site/config'; +import { + AI_TEXT_AUTO_GENERATED_FIELDS, + AI_TEXT_GENERATION_ENABLED, +} from '@/site/config'; interface Params { params: { uploadPath: string } @@ -21,12 +24,15 @@ export default async function UploadPage({ params: { uploadPath } }: Params) { const hasAiTextGeneration = AI_TEXT_GENERATION_ENABLED; + const textFieldsToAutoGenerate = AI_TEXT_AUTO_GENERATED_FIELDS; + return ( ); }; diff --git a/src/components/ExperimentalBadge.tsx b/src/components/ExperimentalBadge.tsx index efeeb59d..0e4b60d9 100644 --- a/src/components/ExperimentalBadge.tsx +++ b/src/components/ExperimentalBadge.tsx @@ -1,4 +1,4 @@ -import clsx from 'clsx/lite'; +import { clsx } from 'clsx/lite'; import Badge from './Badge'; export default function ExperimentalBadge({ diff --git a/src/components/FieldSetWithStatus.tsx b/src/components/FieldSetWithStatus.tsx index d681955d..3c7bdd7f 100644 --- a/src/components/FieldSetWithStatus.tsx +++ b/src/components/FieldSetWithStatus.tsx @@ -24,6 +24,7 @@ export default function FieldSetWithStatus({ capitalize, type = 'text', inputRef, + accessory, }: { id: string label: string @@ -41,6 +42,7 @@ export default function FieldSetWithStatus({ capitalize?: boolean type?: FieldSetType inputRef?: LegacyRef + accessory?: React.ReactNode }) { const { pending } = useFormStatus(); @@ -68,71 +70,76 @@ export default function FieldSetWithStatus({ } - {selectOptions - ? - : tagOptions - ? + {selectOptions + ?