Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switches to multilingual Elevenlabs #181

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Display the image in the message
  • Loading branch information
jp-ipu committed Nov 12, 2023
commit 4f7aca45b0da899cecf11bf070735a8ec95c4770
17 changes: 12 additions & 5 deletions app/src/components/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ export default function MessageComponent(props: { message: Message, last: boolea
return null;
}

const imageElement = props.message.image_url ? (
<img src={props.message.image_url} alt="Message content" className="content-image" />
) : null;

return (
<Container className={"message by-" + props.message.role}>
<div className="inner">
Expand All @@ -257,7 +261,7 @@ export default function MessageComponent(props: { message: Message, last: boolea
{({ copy, copied }) => (
<Button variant="subtle" size="sm" compact onClick={copy} style={{ marginLeft: '1rem' }}>
<i className="fa fa-clipboard" />
{copied ? <FormattedMessage defaultMessage="Copied" description="Label for copy-to-clipboard button after a successful copy" />
{copied ? <FormattedMessage defaultMessage="Copied" description="Label for copy-to-clipboard button after a successful copy" />
: <span><FormattedMessage defaultMessage="Copy" description="Label for copy-to-clipboard button" /></span>}
</Button>
)}
Expand Down Expand Up @@ -291,9 +295,12 @@ export default function MessageComponent(props: { message: Message, last: boolea
</Button>
)}
</div>
{!editing && <Markdown content={props.message.content}
katex={katex}
className={"content content-" + props.message.id} />}
{!editing && (
<div className={"content view-content-" + props.message.id}>
<Markdown content={props.message.content} katex={katex} className={"content content-" + props.message.id} />
{imageElement}
</div>
)}
{editing && (<Editor>
<Textarea value={content}
onChange={e => setContent(e.currentTarget.value)}
Expand All @@ -309,7 +316,7 @@ export default function MessageComponent(props: { message: Message, last: boolea
{props.last && <EndOfChatMarker />}
</Container>
)
}, [props.last, props.share, editing, content, context, props.message, props.message.content, tab]);
}, [props.last, props.share, editing, content, context, props.message, props.message.content, props.message.image_url, tab]);

return elem;
}