improve names
This commit is contained in:
parent
c3e972eb11
commit
4d3c16defb
@ -96,8 +96,9 @@ async def stream_code(websocket: WebSocket):
|
|||||||
async def process_chunk(content):
|
async def process_chunk(content):
|
||||||
await websocket.send_json({"type": "chunk", "value": content})
|
await websocket.send_json({"type": "chunk", "value": content})
|
||||||
|
|
||||||
if params.get("resultImg") and params["resultImg"]:
|
if params.get("resultImage") and params["resultImage"]:
|
||||||
prompt_messages = assemble_prompt(params["image"], params["resultImg"])
|
prompt_messages = assemble_prompt(params["image"], params["resultImage"])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
prompt_messages = assemble_prompt(params["image"])
|
prompt_messages = assemble_prompt(params["image"])
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,8 @@ function App() {
|
|||||||
},
|
},
|
||||||
"setting"
|
"setting"
|
||||||
);
|
);
|
||||||
const [isImgCompare, setIsImgCompare] = useState<boolean>(false);
|
const [shouldIncludeResultImage, setShouldIncludeResultImage] =
|
||||||
|
useState<boolean>(false);
|
||||||
const wsRef = useRef<WebSocket>(null);
|
const wsRef = useRef<WebSocket>(null);
|
||||||
|
|
||||||
const takeScreenshot = async (): Promise<string> => {
|
const takeScreenshot = async (): Promise<string> => {
|
||||||
@ -127,7 +128,7 @@ function App() {
|
|||||||
// Subsequent updates
|
// Subsequent updates
|
||||||
async function doUpdate() {
|
async function doUpdate() {
|
||||||
const updatedHistory = [...history, generatedCode, updateInstruction];
|
const updatedHistory = [...history, generatedCode, updateInstruction];
|
||||||
if (isImgCompare) {
|
if (shouldIncludeResultImage) {
|
||||||
const resultImage = await takeScreenshot();
|
const resultImage = await takeScreenshot();
|
||||||
doGenerateCode({
|
doGenerateCode({
|
||||||
generationType: "update",
|
generationType: "update",
|
||||||
@ -206,18 +207,20 @@ function App() {
|
|||||||
{appState === AppState.CODE_READY && (
|
{appState === AppState.CODE_READY && (
|
||||||
<div>
|
<div>
|
||||||
<div className="grid w-full gap-2">
|
<div className="grid w-full gap-2">
|
||||||
<div className="flex justify-between items-center gap-x-2">
|
|
||||||
<div className="font-500">Auto Image Comparison</div>
|
|
||||||
<Switch
|
|
||||||
checked={isImgCompare}
|
|
||||||
onCheckedChange={setIsImgCompare}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="Tell the AI what to change..."
|
placeholder="Tell the AI what to change..."
|
||||||
onChange={(e) => setUpdateInstruction(e.target.value)}
|
onChange={(e) => setUpdateInstruction(e.target.value)}
|
||||||
value={updateInstruction}
|
value={updateInstruction}
|
||||||
/>
|
/>
|
||||||
|
<div className="flex justify-between items-center gap-x-2">
|
||||||
|
<div className="font-500 text-xs text-slate-700">
|
||||||
|
Include screenshot of current version?
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={shouldIncludeResultImage}
|
||||||
|
onCheckedChange={setShouldIncludeResultImage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<Button onClick={doUpdate}>Update</Button>
|
<Button onClick={doUpdate}>Update</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-x-2 mt-2">
|
<div className="flex items-center gap-x-2 mt-2">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user