base64 preset support
This commit is contained in:
parent
6c73eae9f6
commit
afd15ef2c5
@ -168,8 +168,14 @@ export const ChatPresetEditor: FC<{
|
|||||||
const importPreset = () => {
|
const importPreset = () => {
|
||||||
ClipboardGetText().then((text) => {
|
ClipboardGetText().then((text) => {
|
||||||
try {
|
try {
|
||||||
|
if (!text.trim().startsWith('{'))
|
||||||
|
text = new TextDecoder().decode(
|
||||||
|
new Uint8Array(atob(text)
|
||||||
|
.split('')
|
||||||
|
.map((c) => c.charCodeAt(0))));
|
||||||
const preset = JSON.parse(text);
|
const preset = JSON.parse(text);
|
||||||
setEditingPreset(preset);
|
setEditingPreset(preset);
|
||||||
|
setEditingMessages(false);
|
||||||
toast(t('Imported successfully'), {
|
toast(t('Imported successfully'), {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
autoClose: 1000
|
autoClose: 1000
|
||||||
|
Loading…
Reference in New Issue
Block a user