mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
fix: slash command does not work (#207)
This commit is contained in:
10
src/hooks/useColumns.tsx
vendored
10
src/hooks/useColumns.tsx
vendored
@@ -53,25 +53,25 @@ interface EditRowProps {
|
||||
}
|
||||
export const EditRow: FC<EditRowProps> = ({ rowKey, row, actions }) => {
|
||||
const [isEdit, setEdit] = useState(false);
|
||||
const [val, setVal] = useState(row[rowKey]);
|
||||
const [val, setVal] = useState(row[rowKey] || '');
|
||||
const handleEdit = () => {
|
||||
setEdit(true);
|
||||
};
|
||||
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setVal(e.target.value)
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
setEdit(false);
|
||||
row[rowKey] = val;
|
||||
row[rowKey] = val?.trim();
|
||||
actions?.setRecord(row, 'rowedit')
|
||||
};
|
||||
|
||||
return isEdit
|
||||
? (
|
||||
<Input.TextArea
|
||||
<Input
|
||||
value={val}
|
||||
rows={1}
|
||||
autoFocus
|
||||
onChange={handleChange}
|
||||
{...DISABLE_AUTO_COMPLETE}
|
||||
onPressEnter={handleSave}
|
||||
|
||||
2
src/view/download/index.tsx
vendored
2
src/view/download/index.tsx
vendored
@@ -69,7 +69,6 @@ export default function Download() {
|
||||
const downloadDir = await path.join(await chatRoot(), 'download');
|
||||
await fs.removeDir(downloadDir, { recursive: true });
|
||||
await handleRefresh();
|
||||
rowReset();
|
||||
message.success('All files have been cleared!');
|
||||
return;
|
||||
}
|
||||
@@ -88,6 +87,7 @@ export default function Download() {
|
||||
|
||||
const handleRefresh = async () => {
|
||||
await invoke('download_list', { pathname: CHAT_DOWNLOAD_JSON, dir: 'download' });
|
||||
rowReset();
|
||||
const data = await refreshJson();
|
||||
opInit(data);
|
||||
};
|
||||
|
||||
3
src/view/notes/index.tsx
vendored
3
src/view/notes/index.tsx
vendored
@@ -65,7 +65,6 @@ export default function Notes() {
|
||||
const notesDir = await path.join(await chatRoot(), 'notes');
|
||||
await fs.removeDir(notesDir, { recursive: true });
|
||||
await handleRefresh();
|
||||
rowReset();
|
||||
message.success('All files have been cleared!');
|
||||
return;
|
||||
}
|
||||
@@ -83,6 +82,7 @@ export default function Notes() {
|
||||
|
||||
const handleRefresh = async () => {
|
||||
await invoke('download_list', { pathname: CHAT_NOTES_JSON, dir: 'notes' });
|
||||
rowReset();
|
||||
const data = await refreshJson();
|
||||
opInit(data);
|
||||
};
|
||||
@@ -135,6 +135,7 @@ export default function Notes() {
|
||||
>
|
||||
<ReactMarkdown
|
||||
children={source}
|
||||
linkTarget="_blank"
|
||||
components={{
|
||||
code({node, inline, className, children, ...props}) {
|
||||
const match = /language-(\w+)/.exec(className || '')
|
||||
|
||||
Reference in New Issue
Block a user