Remove 'caption' from default AI text generation
This commit is contained in:
parent
2db33fccb0
commit
440aeeb561
@ -77,11 +77,11 @@ _⚠️ READ BEFORE PROCEEDING_
|
||||
3. Configure auto-generated fields (optional)
|
||||
- Set which text fields auto-generate when uploading a photo by storing a comma-separated list, e.g., `AI_TEXT_AUTO_GENERATED_FIELDS = title, semantic`
|
||||
- Accepted values:
|
||||
- `all` (default)
|
||||
- `title`
|
||||
- `all`
|
||||
- `title` (default)
|
||||
- `caption`
|
||||
- `tags`
|
||||
- `semantic`
|
||||
- `tags` (default)
|
||||
- `semantic` (default)
|
||||
- `none`
|
||||
|
||||
### Web Analytics
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { AiContent } from './useAiImageQueries';
|
||||
import { HiSparkles } from 'react-icons/hi';
|
||||
import { ALL_AI_AUTO_GENERATED_FIELDS, AiAutoGeneratedField } from '.';
|
||||
import { AI_AUTO_GENERATED_FIELDS_ALL, AiAutoGeneratedField } from '.';
|
||||
import { useMemo } from 'react';
|
||||
import LoaderButton from '@/components/primitives/LoaderButton';
|
||||
|
||||
export default function AiButton({
|
||||
aiContent,
|
||||
requestFields = ALL_AI_AUTO_GENERATED_FIELDS,
|
||||
requestFields = AI_AUTO_GENERATED_FIELDS_ALL,
|
||||
shouldConfirm,
|
||||
className,
|
||||
}: {
|
||||
|
||||
@ -8,27 +8,33 @@ export type AiAutoGeneratedField =
|
||||
'tags' |
|
||||
'semantic'
|
||||
|
||||
export const ALL_AI_AUTO_GENERATED_FIELDS: AiAutoGeneratedField[] = [
|
||||
export const AI_AUTO_GENERATED_FIELDS_ALL: AiAutoGeneratedField[] = [
|
||||
'title',
|
||||
'caption',
|
||||
'tags',
|
||||
'semantic',
|
||||
];
|
||||
|
||||
export const AI_AUTO_GENERATED_FIELDS_DEFAULT: AiAutoGeneratedField[] = [
|
||||
'title',
|
||||
'tags',
|
||||
'semantic',
|
||||
];
|
||||
|
||||
export const parseAiAutoGeneratedFieldsText = (
|
||||
text = 'all',
|
||||
text = AI_AUTO_GENERATED_FIELDS_DEFAULT.join(','),
|
||||
): AiAutoGeneratedField[] => {
|
||||
const textFormatted = text.trim().toLocaleLowerCase();
|
||||
if (textFormatted === 'none') {
|
||||
return [];
|
||||
} else if (textFormatted === 'all') {
|
||||
return ALL_AI_AUTO_GENERATED_FIELDS;
|
||||
return AI_AUTO_GENERATED_FIELDS_ALL;
|
||||
} else {
|
||||
const fields = textFormatted
|
||||
.toLocaleLowerCase()
|
||||
.split(',')
|
||||
.map(field => field.trim())
|
||||
.filter(field => ALL_AI_AUTO_GENERATED_FIELDS
|
||||
.filter(field => AI_AUTO_GENERATED_FIELDS_ALL
|
||||
.includes(field as AiAutoGeneratedField));
|
||||
return fields as AiAutoGeneratedField[];
|
||||
}
|
||||
@ -53,7 +59,7 @@ export const getAiImageQuery = (
|
||||
case 'caption': return 'Write a pithy caption for this image in 6 words or less and no punctuation';
|
||||
case 'title-and-caption': return 'Write a compelling title and pithy caption of 8 words or less for this image, using the format Title: "title" Caption: "caption"';
|
||||
case 'tags':
|
||||
const tagQuery = 'Describe this image three or less comma-separated keywords with no adjective or adverbs';
|
||||
const tagQuery = 'Describe this image in three or less comma-separated unique keywords, with no adjective or adverbs, that are specific to this image';
|
||||
const tags = existingTags.map(({ tag }) => tag).join(', ');
|
||||
return tags
|
||||
? `${tagQuery}. Consider using some of these existing tags, but only if they are relevant: ${tags}.`
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import useAiImageQuery from './useAiImageQuery';
|
||||
import useTitleCaptionAiImageQuery from './useTitleCaptionAiImageQuery';
|
||||
import { ALL_AI_AUTO_GENERATED_FIELDS, AiAutoGeneratedField } from '.';
|
||||
import { AI_AUTO_GENERATED_FIELDS_ALL, AiAutoGeneratedField } from '.';
|
||||
|
||||
export type AiContent = ReturnType<typeof useAiImageQueries>;
|
||||
|
||||
@ -59,7 +59,7 @@ export default function useAiImageQueries(
|
||||
const hasRunAllQueriesOnce = useRef(false);
|
||||
|
||||
const request = useCallback(async (
|
||||
fields = ALL_AI_AUTO_GENERATED_FIELDS,
|
||||
fields = AI_AUTO_GENERATED_FIELDS_ALL,
|
||||
) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.log('RUNNING AI QUERIES', fields);
|
||||
|
||||
@ -424,7 +424,9 @@ export default function SiteChecklistClient({
|
||||
>
|
||||
Comma-separated fields to auto-generate when
|
||||
uploading photos. Accepted values: title, caption,
|
||||
tags, description, all, or none (default is {'"all"'}):
|
||||
tags, description, all, or none
|
||||
{' '}
|
||||
(default: {'"title, tags, semantic"'}):
|
||||
{renderEnvVars(['AI_TEXT_AUTO_GENERATED_FIELDS'])}
|
||||
</ChecklistRow>
|
||||
</Checklist>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user