fix errors
This commit is contained in:
parent
874afc1e66
commit
dd0f3b7648
@ -128,7 +128,7 @@ function App() {
|
|||||||
|
|
||||||
function doGenerateCode(
|
function doGenerateCode(
|
||||||
params: CodeGenerationParams,
|
params: CodeGenerationParams,
|
||||||
parentVersion?: number
|
parentVersion: number | null
|
||||||
) {
|
) {
|
||||||
setExecutionConsole([]);
|
setExecutionConsole([]);
|
||||||
setAppState(AppState.CODING);
|
setAppState(AppState.CODING);
|
||||||
@ -166,7 +166,6 @@ function App() {
|
|||||||
...prev,
|
...prev,
|
||||||
{
|
{
|
||||||
type: "ai_edit",
|
type: "ai_edit",
|
||||||
// TODO: It should never be null
|
|
||||||
parent: parentVersion,
|
parent: parentVersion,
|
||||||
code,
|
code,
|
||||||
inputs: {
|
inputs: {
|
||||||
@ -193,10 +192,13 @@ function App() {
|
|||||||
|
|
||||||
setReferenceImages(referenceImages);
|
setReferenceImages(referenceImages);
|
||||||
if (referenceImages.length > 0) {
|
if (referenceImages.length > 0) {
|
||||||
doGenerateCode({
|
doGenerateCode(
|
||||||
generationType: "create",
|
{
|
||||||
image: referenceImages[0],
|
generationType: "create",
|
||||||
});
|
image: referenceImages[0],
|
||||||
|
},
|
||||||
|
currentVersion
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,9 +54,11 @@ export default function HistoryDisplay({
|
|||||||
>
|
>
|
||||||
<div className="flex gap-x-1">
|
<div className="flex gap-x-1">
|
||||||
<h2 className="text-sm">{displayHistoryItemType(item.type)}</h2>
|
<h2 className="text-sm">{displayHistoryItemType(item.type)}</h2>
|
||||||
{item.parent && item.parent !== index - 1 && (
|
{item.parent && item.parent !== index - 1 ? (
|
||||||
<h2 className="text-sm">(parent: v{item.parent + 1})</h2>
|
<h2 className="text-sm">
|
||||||
)}
|
(parent: v{(item.parent || 0) + 1})
|
||||||
|
</h2>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<h2 className="text-sm">
|
<h2 className="text-sm">
|
||||||
{item.type === "ai_edit"
|
{item.type === "ai_edit"
|
||||||
|
|||||||
@ -1,18 +1,19 @@
|
|||||||
export type HistoryItemType = "ai_create" | "ai_edit";
|
export type HistoryItemType = "ai_create" | "ai_edit";
|
||||||
|
|
||||||
|
type CommonHistoryItem = {
|
||||||
|
parent: null | number;
|
||||||
|
code: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type HistoryItem =
|
export type HistoryItem =
|
||||||
| {
|
| ({
|
||||||
type: "ai_create";
|
type: "ai_create";
|
||||||
parent: null | number;
|
|
||||||
code: string;
|
|
||||||
inputs: AiCreateInputs;
|
inputs: AiCreateInputs;
|
||||||
}
|
} & CommonHistoryItem)
|
||||||
| {
|
| ({
|
||||||
type: "ai_edit";
|
type: "ai_edit";
|
||||||
parent: null | number;
|
|
||||||
code: string;
|
|
||||||
inputs: AiEditInputs;
|
inputs: AiEditInputs;
|
||||||
};
|
} & CommonHistoryItem);
|
||||||
|
|
||||||
export type AiCreateInputs = {
|
export type AiCreateInputs = {
|
||||||
image_url: string;
|
image_url: string;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user