Skip to content

Commit

Permalink
AI Persona Creator: Update the react state after 575
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Jul 7, 2024
1 parent 92206d9 commit 3a44f70
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/apps/personas/creator/Creator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ const Prompts: string[] = [
'Compare the draft character sheet with the original transcript, validating its content and ensuring it captures both the speaker’s overt characteristics and the subtler undertones. Omit unknown information, fine-tune any areas that require clarity, have been overlooked, or require more authenticity. Use clear and illustrative examples from the transcript to refine your sheet and offer meaningful, tangible reference points. Your output is a coherent, comprehensive, and nuanced instruction that begins with \'You are a...\' and serves as a go-to guide for an actor recreating the persona.',
];

const PromptTitles = (selectedTab: number): string[] => {
const analyzeSubject: string = selectedTab ? 'text' : 'transcript';
const getTitlesForTab = (selectedTab: number): string[] => {
const analyzeSubject: string = selectedTab ? 'text' : 'transcript';
return [
'Common: Creator System Prompt',
`Analyze the ${analyzeSubject}`,
'Define the character',
'Cross the t\'s',
]
'Cross the t\'s',
];
};

// chain to convert a text input string (e.g. youtube transcript) into a persona prompt
Expand Down Expand Up @@ -102,16 +102,18 @@ export function Creator(props: { display: boolean }) {


// editable prompts
const promptTitles = React.useMemo(() => getTitlesForTab(selectedTab), [selectedTab]);

const {
strings: editedInstructions, stringEditors: instructionEditors,
} = useFormEditTextArray(Prompts, PromptTitles(selectedTab));
} = useFormEditTextArray(Prompts, promptTitles);

const { steps: creationChainSteps, id: chainId } = React.useMemo(() => {
return {
steps: createChain(editedInstructions, PromptTitles(selectedTab)),
steps: createChain(editedInstructions, promptTitles),
id: uuidv4(),
};
}, [editedInstructions]);
}, [editedInstructions, promptTitles]);

const llmLabel = personaLlm?.label || undefined;
const savePersona = React.useCallback((personaPrompt: string, inputText: string) => {
Expand Down

0 comments on commit 3a44f70

Please sign in to comment.