feat: update interface and fix close bug
This commit is contained in:
parent
02c3178b6b
commit
bc73613fb1
@ -10,6 +10,7 @@ const STOP_MESSAGE = "Code generation stopped";
|
|||||||
export interface CodeGenerationParams {
|
export interface CodeGenerationParams {
|
||||||
generationType: "create" | "update";
|
generationType: "create" | "update";
|
||||||
image: string;
|
image: string;
|
||||||
|
resultImg?: string;
|
||||||
history?: string[];
|
history?: string[];
|
||||||
// isImageGenerationEnabled: boolean; // TODO: Merge with Settings type in types.ts
|
// isImageGenerationEnabled: boolean; // TODO: Merge with Settings type in types.ts
|
||||||
}
|
}
|
||||||
@ -49,13 +50,11 @@ export function generateCode(
|
|||||||
console.log("Connection closed", event.code, event.reason);
|
console.log("Connection closed", event.code, event.reason);
|
||||||
if (event.code === USER_CLOSE_WEB_SOCKET_CODE) {
|
if (event.code === USER_CLOSE_WEB_SOCKET_CODE) {
|
||||||
toast.success(STOP_MESSAGE);
|
toast.success(STOP_MESSAGE);
|
||||||
onComplete();
|
} else if (event.code !== 1000) {
|
||||||
} else if (event.code === 1000) {
|
|
||||||
onComplete();
|
|
||||||
} else {
|
|
||||||
console.error("WebSocket error code", event);
|
console.error("WebSocket error code", event);
|
||||||
toast.error(ERROR_MESSAGE);
|
toast.error(ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
onComplete();
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.addEventListener("error", (error) => {
|
ws.addEventListener("error", (error) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user