Merge pull request #6624 from uinstinct/session-file
This commit is contained in:
commit
73fcce73ce
1 changed files with 26 additions and 1 deletions
|
|
@ -1,13 +1,14 @@
|
|||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
DocumentArrowUpIcon,
|
||||
NumberedListIcon,
|
||||
PaintBrushIcon,
|
||||
TableCellsIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useAppDispatch } from "../../redux/hooks";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { setOnboardingCard } from "../../redux/slices/uiSlice";
|
||||
import { saveCurrentSession } from "../../redux/thunks/session";
|
||||
import { ROUTES } from "../../util/navigation";
|
||||
|
|
@ -18,6 +19,21 @@ export function HelpCenterSection() {
|
|||
const navigate = useNavigate();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const currentSession = useAppSelector((state) => state.session);
|
||||
|
||||
const handleViewSessionData = async () => {
|
||||
const sessionData = await ideMessenger.request("history/load", {
|
||||
id: currentSession.id,
|
||||
});
|
||||
|
||||
if (sessionData.status === "success") {
|
||||
await ideMessenger.request("showVirtualFile", {
|
||||
name: `${sessionData.content.title}.json`,
|
||||
content: JSON.stringify(sessionData.content, null, 2),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="py-5">
|
||||
<h3 className="mb-4 mt-0 text-xl">Help center</h3>
|
||||
|
|
@ -68,6 +84,15 @@ export function HelpCenterSection() {
|
|||
onClick={() => navigate("/stats")}
|
||||
/>
|
||||
|
||||
{currentSession.history.length > 0 && !currentSession.isStreaming && (
|
||||
<MoreHelpRow
|
||||
title="View current session history"
|
||||
description="Open the current chat session file for troubleshooting"
|
||||
Icon={NumberedListIcon}
|
||||
onClick={handleViewSessionData}
|
||||
/>
|
||||
)}
|
||||
|
||||
<MoreHelpRow
|
||||
title="Quickstart"
|
||||
description="Reopen the quickstart and tutorial file"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue