move files around
This commit is contained in:
parent
a5e7dcd037
commit
79e36c9529
@ -30,9 +30,8 @@ import { USER_CLOSE_WEB_SOCKET_CODE } from "./constants";
|
||||
import CodeTab from "./components/CodeTab";
|
||||
import OutputSettingsSection from "./components/OutputSettingsSection";
|
||||
import { History } from "./history_types";
|
||||
import HistoryDisplay, {
|
||||
extractHistoryTree,
|
||||
} from "./components/HistoryDisplay";
|
||||
import HistoryDisplay from "./components/history/HistoryDisplay";
|
||||
import { extractHistoryTree } from "./components/history/utils";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
const IS_OPENAI_DOWN = false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||
import { History, HistoryItemType } from "../history_types";
|
||||
import { History, HistoryItemType } from "../../history_types";
|
||||
import toast from "react-hot-toast";
|
||||
import classNames from "classnames";
|
||||
|
||||
@ -10,29 +10,6 @@ interface Props {
|
||||
shouldDisableReverts: boolean;
|
||||
}
|
||||
|
||||
export function extractHistoryTree(
|
||||
history: History,
|
||||
version: number
|
||||
): string[] {
|
||||
// History is in reverse chronological order
|
||||
|
||||
// Get all history items up to the current version
|
||||
const extractedHistory = history.slice(version);
|
||||
|
||||
const obj: string[] = [];
|
||||
|
||||
// Reverse the history so that it is in chronological order for the server
|
||||
extractedHistory.reverse().forEach((item) => {
|
||||
// Don't include the image for ai_create since the server gets it passed and will include it directly
|
||||
if (item.type !== "ai_create") {
|
||||
obj.push(item.inputs.prompt);
|
||||
}
|
||||
obj.push(item.code);
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function displayHistoryItemType(itemType: HistoryItemType) {
|
||||
switch (itemType) {
|
||||
case "ai_create":
|
||||
24
frontend/src/components/history/utils.ts
Normal file
24
frontend/src/components/history/utils.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { History } from "../../history_types";
|
||||
|
||||
export function extractHistoryTree(
|
||||
history: History,
|
||||
version: number
|
||||
): string[] {
|
||||
// History is in reverse chronological order
|
||||
|
||||
// Get all history items up to the current version
|
||||
const extractedHistory = history.slice(version);
|
||||
|
||||
const obj: string[] = [];
|
||||
|
||||
// Reverse the history so that it is in chronological order for the server
|
||||
extractedHistory.reverse().forEach((item) => {
|
||||
// Don't include the image for ai_create since the server gets it passed and will include it directly
|
||||
if (item.type !== "ai_create") {
|
||||
obj.push(item.inputs.prompt);
|
||||
}
|
||||
obj.push(item.code);
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user