forked from open-webui/open-webui
feat: save message
This commit is contained in:
parent
cc50cc10e6
commit
d863e7e60b
2 changed files with 20 additions and 5 deletions
|
@ -309,6 +309,16 @@
|
||||||
{copyToClipboard}
|
{copyToClipboard}
|
||||||
{continueGeneration}
|
{continueGeneration}
|
||||||
{regenerateResponse}
|
{regenerateResponse}
|
||||||
|
on:save={async (e) => {
|
||||||
|
console.log('save', e);
|
||||||
|
|
||||||
|
const message = e.detail;
|
||||||
|
history.messages[message.id] = message;
|
||||||
|
await updateChatById(localStorage.token, chatId, {
|
||||||
|
messages: messages,
|
||||||
|
history: history
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,22 +2,25 @@
|
||||||
import toast from 'svelte-french-toast';
|
import toast from 'svelte-french-toast';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import { config, settings } from '$lib/stores';
|
|
||||||
import tippy from 'tippy.js';
|
import tippy from 'tippy.js';
|
||||||
import auto_render from 'katex/dist/contrib/auto-render.mjs';
|
import auto_render from 'katex/dist/contrib/auto-render.mjs';
|
||||||
import 'katex/dist/katex.min.css';
|
import 'katex/dist/katex.min.css';
|
||||||
|
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
import { onMount, tick } from 'svelte';
|
import { onMount, tick } from 'svelte';
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
import { config, settings } from '$lib/stores';
|
||||||
|
import { synthesizeOpenAISpeech } from '$lib/apis/openai';
|
||||||
|
import { imageGenerations } from '$lib/apis/images';
|
||||||
|
import { extractSentences } from '$lib/utils';
|
||||||
|
|
||||||
import Name from './Name.svelte';
|
import Name from './Name.svelte';
|
||||||
import ProfileImage from './ProfileImage.svelte';
|
import ProfileImage from './ProfileImage.svelte';
|
||||||
import Skeleton from './Skeleton.svelte';
|
import Skeleton from './Skeleton.svelte';
|
||||||
import CodeBlock from './CodeBlock.svelte';
|
import CodeBlock from './CodeBlock.svelte';
|
||||||
|
|
||||||
import { synthesizeOpenAISpeech } from '$lib/apis/openai';
|
|
||||||
import { extractSentences } from '$lib/utils';
|
|
||||||
import { imageGenerations } from '$lib/apis/images';
|
|
||||||
|
|
||||||
export let modelfiles = [];
|
export let modelfiles = [];
|
||||||
export let message;
|
export let message;
|
||||||
export let siblings;
|
export let siblings;
|
||||||
|
@ -280,6 +283,8 @@
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: `data:image/png;base64,${image}`
|
url: `data:image/png;base64,${image}`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
dispatch('save', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
generatingImage = false;
|
generatingImage = false;
|
||||||
|
|
Loading…
Reference in a new issue