mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-06 15:36:21 +00:00
code
This commit is contained in:
@@ -30,7 +30,8 @@ const ChatHistorySlider = ({
|
||||
activeHistoryId,
|
||||
onChangeChat,
|
||||
onDelHistory,
|
||||
onSetHistoryTop
|
||||
onSetHistoryTop,
|
||||
onUpdateTitle
|
||||
}: {
|
||||
appId?: string;
|
||||
appName: string;
|
||||
@@ -40,6 +41,7 @@ const ChatHistorySlider = ({
|
||||
onChangeChat: (historyId?: string) => void;
|
||||
onDelHistory: (historyId: string) => void;
|
||||
onSetHistoryTop?: (e: { historyId: string; top: boolean }) => void;
|
||||
onUpdateTitle?: (e: { historyId: string; title: string }) => void;
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
const router = useRouter();
|
||||
@@ -159,6 +161,20 @@ const ChatHistorySlider = ({
|
||||
{item.top ? '取消置顶' : '置顶'}
|
||||
</MenuItem>
|
||||
)}
|
||||
{/* {onUpdateTitle && (
|
||||
<MenuItem
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onUpdateTitle({
|
||||
historyId: item.id,
|
||||
title: '是是是'
|
||||
});
|
||||
}}
|
||||
>
|
||||
<MyIcon mr={2} name={'customTitle'} w={'16px'}></MyIcon>
|
||||
自定义标题
|
||||
</MenuItem>
|
||||
)} */}
|
||||
<MenuItem
|
||||
_hover={{ color: 'red.500' }}
|
||||
onClick={(e) => {
|
||||
|
@@ -24,7 +24,7 @@ const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
|
||||
},
|
||||
{ icon: 'pdf', label: 'PDF导出', onClick: () => onExportChat({ type: 'pdf', history }) }
|
||||
]);
|
||||
return (
|
||||
return history.length > 0 ? (
|
||||
<Menu autoSelect={false} isLazy>
|
||||
<MenuButton
|
||||
_hover={{ bg: 'myWhite.600 ' }}
|
||||
@@ -45,7 +45,7 @@ const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
|
||||
))}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
);
|
||||
) : null;
|
||||
};
|
||||
|
||||
export default ToolMenu;
|
||||
|
@@ -260,6 +260,20 @@ const Chat = () => {
|
||||
});
|
||||
} catch (error) {}
|
||||
}}
|
||||
onUpdateTitle={async (e) => {
|
||||
try {
|
||||
await putChatHistory({
|
||||
historyId: e.historyId,
|
||||
customTitle: e.title
|
||||
});
|
||||
const historyItem = history.find((item) => item._id === e.historyId);
|
||||
if (!historyItem) return;
|
||||
updateHistory({
|
||||
...historyItem,
|
||||
title: e.title
|
||||
});
|
||||
} catch (error) {}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* chat container */}
|
||||
|
Reference in New Issue
Block a user