mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 03:10:15 +01:00
fix: fileName formatting fixes
This commit is contained in:
parent
4245b43140
commit
31cef16cc3
4 changed files with 103 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { useSetRecoilState, useRecoilValue } from 'recoil';
|
||||
import filenamify from 'filenamify';
|
||||
import axios from 'axios';
|
||||
import exportFromJSON from 'export-from-json';
|
||||
import DialogTemplate from '../ui/DialogTemplate';
|
||||
|
|
@ -51,9 +52,10 @@ const EditPresetDialog = ({ open, onOpenChange, preset: _preset, title }) => {
|
|||
};
|
||||
|
||||
const exportPreset = () => {
|
||||
const fileName = filenamify(preset?.title || 'preset');
|
||||
exportFromJSON({
|
||||
data: cleanupPreset({ preset, endpointsFilter }),
|
||||
fileName: `${preset?.title}.json`,
|
||||
fileName,
|
||||
exportType: exportFromJSON.types.json
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { useRecoilValue, useRecoilCallback } from 'recoil';
|
||||
import filenamify from 'filenamify';
|
||||
import exportFromJSON from 'export-from-json';
|
||||
import download from 'downloadjs';
|
||||
import DialogTemplate from '~/components/ui/DialogTemplate.jsx';
|
||||
|
|
@ -40,9 +41,7 @@ export default function ExportModel({ open, onOpenChange }) {
|
|||
|
||||
useEffect(() => {
|
||||
setFileName(
|
||||
String(conversation?.title)
|
||||
.replace(/[^a-z0-9]/gi, '_')
|
||||
.toLowerCase() || 'file'
|
||||
filenamify(String(conversation?.title || 'file'))
|
||||
);
|
||||
setType('text');
|
||||
setIncludeOptions(true);
|
||||
|
|
@ -292,7 +291,7 @@ export default function ExportModel({ open, onOpenChange }) {
|
|||
<Input
|
||||
id="filename"
|
||||
value={filename}
|
||||
onChange={e => setFileName(e.target.value || '')}
|
||||
onChange={e => setFileName(filenamify(e.target.value || ''))}
|
||||
placeholder="Set the filename"
|
||||
className={cn(
|
||||
defaultTextProps,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue