mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 17:33:59 +01:00
fix: ShareGPT bug
This commit is contained in:
parent
f797f6984c
commit
1b2f80c85b
|
@ -128,7 +128,7 @@ const ContentView = React.memo(
|
|||
|
||||
return (
|
||||
<>
|
||||
<div className='markdown prose w-full break-words dark:prose-invert dark'>
|
||||
<div className='markdown prose w-full break-words dark:prose-invert dark share-gpt-message'>
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[
|
||||
remarkGfm,
|
||||
|
|
|
@ -14,13 +14,19 @@ const ShareGPT = React.memo(() => {
|
|||
const chats = useStore.getState().chats;
|
||||
const currentChatIndex = useStore.getState().currentChatIndex;
|
||||
if (chats) {
|
||||
const items: ShareGPTSubmitBodyInterface['items'] = chats[
|
||||
currentChatIndex
|
||||
].messages.map((message) => ({
|
||||
from: 'gpt',
|
||||
value: `<p><b>${t(message.role)}</b></p>${message.content}`,
|
||||
}));
|
||||
try {
|
||||
const items: ShareGPTSubmitBodyInterface['items'] = [];
|
||||
const messages = document.querySelectorAll('.share-gpt-message');
|
||||
|
||||
messages.forEach((message, index) => {
|
||||
items.push({
|
||||
from: 'gpt',
|
||||
value: `<p><b>${t(
|
||||
chats[currentChatIndex].messages[index].role
|
||||
)}</b></p>${message.innerHTML}`,
|
||||
});
|
||||
});
|
||||
|
||||
await submitShareGPT({
|
||||
avatarUrl: '',
|
||||
items,
|
||||
|
|
Loading…
Reference in a new issue