Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Fix bug api and manage error
Browse files Browse the repository at this point in the history
  • Loading branch information
watchakorn-18k committed May 26, 2023
1 parent 03cf6b5 commit 4b22652
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<meta property="twitter:description" content="Genarate Image From Image, สร้างรูปภาพด้วยข้อความแบบฟรีไม่เสียเงิน">
<meta property="twitter:image" content="https://cdn.discordapp.com/attachments/585069498986397707/1111517913015402537/6fa251c196ebc9221d3690b2f7cef060.png">
<title>Genarate Image | สร้างรูปภาพด้วยข้อความ</title>
<script type="module" crossorigin src="/generate_image_web/assets/index-9e73b38d.js"></script>
<script type="module" crossorigin src="/generate_image_web/assets/index-3e458257.js"></script>
<link rel="stylesheet" href="/generate_image_web/assets/index-e1048ace.css">
</head>

Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ npm run build


# Changelog
- v1.1.6 Fix bug api and manage error front end and back end
- v1.1.5 Check bad words in prompt
- v1.1.4 Fix UI responsive layout tablet
- v1.1.3 Change name donwload image
Expand Down
25 changes: 13 additions & 12 deletions src/components/TextPrompt/TextPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ export default function TextPrompt({ status_gen ,status_erro }: Props) {
if (open) {
const timeoutId = setTimeout(() => {
setOpen(false);
}, 2000);
}, 1000);
return () => clearTimeout(timeoutId);
}
}, [open]);


// useEffect(() => {
// if (openError) {
// const timeoutId = setTimeout(() => {
// setOpenError(false);
// }, 2000);
// return () => clearTimeout(timeoutId);
// }
// }, [openError]);
useEffect(() => {
const timeoutId = setInterval(() => {
if (status_erro) {
setOpenError(true);

}
}, 1000);
return () => clearTimeout(timeoutId);
}, [status_erro]);

const SendData = () => {
if (inputText != "") {
Expand Down Expand Up @@ -87,6 +88,7 @@ export default function TextPrompt({ status_gen ,status_erro }: Props) {
onChange={handleInputChange}
disabled={!status_gen}
onKeyDown={handleKeyDown}
value={inputText}
/>
<Tooltip className="text" content={t("tool-tip-generate")} >
<button
Expand Down Expand Up @@ -119,9 +121,8 @@ export default function TextPrompt({ status_gen ,status_erro }: Props) {
`${import.meta.env.VITE_URL_STATUS_ERR }`,
{ status_erro: false }
)
.then((response) => {
console.log(response);

.then(() => {
setInputText("");
setOpenError(false);
})
.catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"tool-tip-generate":"Start generate image",
"tool-tip-image":"Image",
"scenario":"Scenario",
"status_err":"Your prompt has been blocked by Bing. Try to change any bad words and try again."
"status_err":"Your prompt has been blocked by Bing. Try to change any bad words and try again or unable to portray this word."
}
2 changes: 1 addition & 1 deletion src/locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"tool-tip-generate":"เริ่มสร้างภาพ",
"tool-tip-image":"รูปภาพ",
"scenario":"สถานการณ์ที่",
"status_err":"พรอมต์ของคุณถูกบล็อกโดย Bing เปลี่ยนคำเป็นคำที่ดีกว่านี้หน่อยนะ"
"status_err":"พรอมต์ของคุณถูกบล็อกโดย Bing เปลี่ยนคำเป็นคำที่ดีกว่านี้หน่อยนะหรือไม่สามารถวาดภาพคำนี้ได้"
}

0 comments on commit 4b22652

Please sign in to comment.