chore: export

This commit is contained in:
lencx
2023-01-14 23:31:12 +08:00
parent a2fcfa3b89
commit ae2c56805c
15 changed files with 264 additions and 69 deletions

View File

@@ -1,4 +1,4 @@
import { Switch, Tag, Tooltip } from 'antd';
import { Table, Switch, Tag } from 'antd';
import { genCmd } from '@/utils';
@@ -35,13 +35,14 @@ export const syncColumns = () => [
<Switch checked={v} onChange={(v) => action.setRecord({ ...row, enable: v }, 'enable')} />
),
},
Table.EXPAND_COLUMN,
{
title: 'Prompt',
dataIndex: 'prompt',
key: 'prompt',
// width: 300,
render: (v: string) => (
<Tooltip overlayInnerStyle={{ width: 350 }} title={v}><span className="chat-prompts-val">{v}</span></Tooltip>
<span className="chat-prompts-val">{v}</span>
),
},
];

View File

@@ -6,7 +6,7 @@ import useInit from '@/hooks/useInit';
import useData from '@/hooks/useData';
import useColumns from '@/hooks/useColumns';
import useChatModel, { useCacheModel } from '@/hooks/useChatModel';
import useTable, { TABLE_PAGINATION } from '@/hooks/useTable';
import { useTableRowSelection, TABLE_PAGINATION } from '@/hooks/useTable';
import { fmtDate, chatRoot } from '@/utils';
import { syncColumns } from './config';
import './index.scss';
@@ -14,7 +14,7 @@ import './index.scss';
const promptsURL = 'https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv';
export default function SyncPrompts() {
const { rowSelection, selectedRowIDs } = useTable();
const { rowSelection, selectedRowIDs } = useTableRowSelection();
const [jsonPath, setJsonPath] = useState('');
const { modelJson, modelSet } = useChatModel('sync_prompts');
const { modelCacheJson, modelCacheSet } = useCacheModel(jsonPath);
@@ -93,6 +93,7 @@ export default function SyncPrompts() {
dataSource={opData}
rowSelection={rowSelection}
pagination={TABLE_PAGINATION}
expandable={{expandedRowRender: (record) => <div style={{ padding: 10 }}>{record.prompt}</div>}}
/>
</div>
)