Fix parameter type for generateCode
This commit is contained in:
parent
3bd2321b83
commit
edfafa2c48
@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from "react";
|
|||||||
import ImageUpload from "./components/ImageUpload";
|
import ImageUpload from "./components/ImageUpload";
|
||||||
import CodePreview from "./components/CodePreview";
|
import CodePreview from "./components/CodePreview";
|
||||||
import Preview from "./components/Preview";
|
import Preview from "./components/Preview";
|
||||||
import { CodeGenerationParams, generateCode } from "./generateCode";
|
import { generateCode } from "./generateCode";
|
||||||
import Spinner from "./components/Spinner";
|
import Spinner from "./components/Spinner";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import {
|
import {
|
||||||
@ -18,7 +18,13 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs";
|
||||||
import SettingsDialog from "./components/SettingsDialog";
|
import SettingsDialog from "./components/SettingsDialog";
|
||||||
import { Settings, EditorTheme, AppState, GeneratedCodeConfig } from "./types";
|
import {
|
||||||
|
AppState,
|
||||||
|
CodeGenerationParams,
|
||||||
|
EditorTheme,
|
||||||
|
GeneratedCodeConfig,
|
||||||
|
Settings,
|
||||||
|
} from "./types";
|
||||||
import { IS_RUNNING_ON_CLOUD } from "./config";
|
import { IS_RUNNING_ON_CLOUD } from "./config";
|
||||||
import { PicoBadge } from "./components/PicoBadge";
|
import { PicoBadge } from "./components/PicoBadge";
|
||||||
import { OnboardingNote } from "./components/OnboardingNote";
|
import { OnboardingNote } from "./components/OnboardingNote";
|
||||||
|
|||||||
@ -1,23 +1,16 @@
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { WS_BACKEND_URL } from "./config";
|
import { WS_BACKEND_URL } from "./config";
|
||||||
import { USER_CLOSE_WEB_SOCKET_CODE } from "./constants";
|
import { USER_CLOSE_WEB_SOCKET_CODE } from "./constants";
|
||||||
|
import { FullGenerationSettings } from "./types";
|
||||||
|
|
||||||
const ERROR_MESSAGE =
|
const ERROR_MESSAGE =
|
||||||
"Error generating code. Check the Developer Console AND the backend logs for details. Feel free to open a Github issue.";
|
"Error generating code. Check the Developer Console AND the backend logs for details. Feel free to open a Github issue.";
|
||||||
|
|
||||||
const STOP_MESSAGE = "Code generation stopped";
|
const STOP_MESSAGE = "Code generation stopped";
|
||||||
|
|
||||||
export interface CodeGenerationParams {
|
|
||||||
generationType: "create" | "update";
|
|
||||||
image: string;
|
|
||||||
resultImage?: string;
|
|
||||||
history?: string[];
|
|
||||||
// isImageGenerationEnabled: boolean; // TODO: Merge with Settings type in types.ts
|
|
||||||
}
|
|
||||||
|
|
||||||
export function generateCode(
|
export function generateCode(
|
||||||
wsRef: React.MutableRefObject<WebSocket | null>,
|
wsRef: React.MutableRefObject<WebSocket | null>,
|
||||||
params: CodeGenerationParams,
|
params: FullGenerationSettings,
|
||||||
onChange: (chunk: string) => void,
|
onChange: (chunk: string) => void,
|
||||||
onSetCode: (code: string) => void,
|
onSetCode: (code: string) => void,
|
||||||
onStatusUpdate: (status: string) => void,
|
onStatusUpdate: (status: string) => void,
|
||||||
|
|||||||
@ -28,3 +28,13 @@ export enum AppState {
|
|||||||
CODING = "CODING",
|
CODING = "CODING",
|
||||||
CODE_READY = "CODE_READY",
|
CODE_READY = "CODE_READY",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CodeGenerationParams {
|
||||||
|
generationType: "create" | "update";
|
||||||
|
image: string;
|
||||||
|
resultImage?: string;
|
||||||
|
history?: string[];
|
||||||
|
// isImageGenerationEnabled: boolean; // TODO: Merge with Settings type in types.ts
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FullGenerationSettings = CodeGenerationParams & Settings;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user