Skip to content

Commit

Permalink
Persona Creator: correct display. #685
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Dec 11, 2024
1 parent 3bf0c10 commit 68630a0
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/apps/personas/creator/Creator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import SettingsAccessibilityIcon from '@mui/icons-material/SettingsAccessibility';

import { LLMChainStep, useLLMChain } from '~/modules/aifn/useLLMChain';
import { RenderMarkdownMemo } from '~/modules/blocks/markdown/RenderMarkdown';
import { ScaledTextBlockRenderer } from '~/modules/blocks/ScaledTextBlockRenderer';

import type { ContentScaling } from '~/common/app.theme';
import { GoodTooltip } from '~/common/components/GoodTooltip';
import { agiUuid } from '~/common/util/idUtils';
import { copyToClipboard } from '~/common/util/clipboardUtils';
import { useFormEditTextArray } from '~/common/components/forms/useFormEditTextArray';
import { useLLMSelect, useLLMSelectLocalState } from '~/common/components/forms/useLLMSelect';
import { useToggleableBoolean } from '~/common/util/hooks/useToggleableBoolean';
import { useUIContentScaling } from '~/common/state/store-ui';

import { FromText } from './FromText';
import { FromYouTube } from './FromYouTube';
Expand Down Expand Up @@ -64,7 +66,10 @@ function createChain(instructions: string[], titles: string[]): LLMChainStep[] {
}


export const PersonaPromptCard = (props: { content: string }) =>
export const PersonaPromptCard = (props: {
content: string,
contentScaling: ContentScaling,
}) =>
<Card sx={{ boxShadow: 'md', mt: 3 }}>

<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
Expand All @@ -82,7 +87,11 @@ export const PersonaPromptCard = (props: { content: string }) =>
<Alert variant='soft' color='success' sx={{ mb: 1 }}>
You may now copy the text below and use it as Custom prompt!
</Alert>
<RenderMarkdownMemo content={props.content} />
<ScaledTextBlockRenderer
text={props.content}
contentScaling={props.contentScaling}
textRenderVariant='markdown'
/>
</CardContent>
</Card>;

Expand All @@ -97,6 +106,7 @@ export function Creator(props: { display: boolean }) {
const [showIntermediates, setShowIntermediates] = React.useState(false);

// external state
const contentScaling = useUIContentScaling();
const [personaLlmId, setPersonaLlmId] = useLLMSelectLocalState(true);
const [personaLlm, llmComponent] = useLLMSelect(personaLlmId, setPersonaLlmId, 'Persona Creation Model');

Expand Down Expand Up @@ -278,7 +288,10 @@ export function Creator(props: { display: boolean }) {

{/* The Persona (Output) */}
{chainOutputText && <>
<PersonaPromptCard content={chainOutputText} />
<PersonaPromptCard
content={chainOutputText}
contentScaling={contentScaling}
/>
</>}


Expand Down

0 comments on commit 68630a0

Please sign in to comment.