mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 21:43:59 +01:00
fix: ShareGPT bug
This commit is contained in:
parent
f797f6984c
commit
1b2f80c85b
|
@ -128,7 +128,7 @@ const ContentView = React.memo(
|
||||||
|
|
||||||
return (
|
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
|
<ReactMarkdown
|
||||||
remarkPlugins={[
|
remarkPlugins={[
|
||||||
remarkGfm,
|
remarkGfm,
|
||||||
|
|
|
@ -14,13 +14,19 @@ const ShareGPT = React.memo(() => {
|
||||||
const chats = useStore.getState().chats;
|
const chats = useStore.getState().chats;
|
||||||
const currentChatIndex = useStore.getState().currentChatIndex;
|
const currentChatIndex = useStore.getState().currentChatIndex;
|
||||||
if (chats) {
|
if (chats) {
|
||||||
const items: ShareGPTSubmitBodyInterface['items'] = chats[
|
|
||||||
currentChatIndex
|
|
||||||
].messages.map((message) => ({
|
|
||||||
from: 'gpt',
|
|
||||||
value: `<p><b>${t(message.role)}</b></p>${message.content}`,
|
|
||||||
}));
|
|
||||||
try {
|
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({
|
await submitShareGPT({
|
||||||
avatarUrl: '',
|
avatarUrl: '',
|
||||||
items,
|
items,
|
||||||
|
|
Loading…
Reference in a new issue