{
"data": {
"pulsarforge.near": {
"widget": {
"ai-ancestors-characters": {
"": "State.init({\n queryPlanet: \"Strong\",\n generation,\n images: [],\n});\nconst handleInputChange = ({ target }) => {\n State.update({ queryPlanet: target.value });\n};\n\nconst TextArea = styled.textarea`\n display: block;\n padding:.5em;\n width:100%;\n border: 1px solid #e5e8eb;\n border-radius: 10px;\n outline: none;\n background: #f4f5f6;\n color: #525c76;\n :focus{\n border:1px solid #0d99ff;\n }\n`;\nconst Wrapper = styled.div``;\n\nconst handleImages = () => {\n const urlImages = \"https://bos-ancestors-images.pulsarforge.workers.dev/\";\n var resp = fetch(urlImages);\n\n State.update({ generation: resp.body.generations });\n};\nconst handleImagesUpdate = () => {\n State.update({ generation: undefined });\n};\nconst handleSubmit = () => {\n // The base URL for our API\n const url = \"https://bos-ancestors.pulsarforge.workers.dev/\";\n const queryP = state.queryPlanet;\n asyncFetch(url, {\n method: \"POST\",\n body: JSON.stringify({ queryPlanet: queryP }),\n mode: \"no-cors\",\n })\n .then((response) => response)\n .catch((err) => console.log(err));\n};\n\nconsole.log(\"STATE GENERATION\", state.generation);\nreturn (\n <Wrapper>\n <div className=\"row\">\n <TextArea placeholder=\"red bird, outdoor\" onChange={handleInputChange} />\n <button\n onClick={handleSubmit}\n type=\"submit\"\n className=\"btn btn-primary\"\n style={{\n width: \"100%\",\n padding: 25,\n marginTop: 20,\n marginBottom: 20,\n borderRadius: 20,\n }}\n >\n Send Query to Create Character\n </button>\n <h4>red bird, daylight, outdoor, cinema 4d</h4>\n {state.generation ? (\n <>\n <div className=\"row\">\n <div className=\"col-md-2\"></div>\n <div className=\"col-md-8\">\n <h4>Get your character here, to use again F5</h4>\n <br />\n <br />\n </div>\n <div className=\"col-md-2\"></div>\n </div>\n <div className=\"row\">\n {state.generation.map(\n (leoImage, index) =>\n index === 0 && (\n <div className=\"row\" key={index}>\n {leoImage.generated_images.map((leoGenerate, idx) => (\n <>\n <div className=\"col-md-12\" key={idx}>\n <h2>Gen {idx + 1}</h2>\n <img\n src={leoGenerate?.url}\n style={{\n width: \"95%\",\n borderRadius: 40,\n }}\n alt=\"generations\"\n />\n </div>\n </>\n ))}\n <h5>Previous Creator Prompt: {leoImage.prompt}</h5>\n </div>\n )\n )}\n </div>\n </>\n ) : (\n <h4>\n <br />\n Submit, wait 5 seconds and discover your by clicking Get Character, to\n use once again F5.\n <br />\n <br />\n </h4>\n )}\n <button\n onClick={handleImages}\n type=\"submit\"\n className=\"btn btn-primary\"\n style={{\n width: \"100%\",\n padding: 25,\n marginTop: 20,\n marginBottom: 20,\n borderRadius: 20,\n }}\n >\n Get Character\n </button>\n <h2>\n <a href=\"https://ancestors.pulsarforge.io/\" target=\"_blank\">\n {\" \"}\n Visit Ancestors\n </a>\n </h2>\n <h5> Sample: </h5>\n <img\n src=\"https://cdn.leonardo.ai/users/fc497577-e347-4826-85fa-48e611881c4e/generations/3c9c5468-e44c-422a-b5d1-6811e4f5acee/3D_Animation_Style_red_bird_daylight_outdoor_cinema_4d_0.jpg\"\n alt=\"Otter\"\n style={{ width: \"35%\", borderRadius: 40 }}\n />\n </div>\n </Wrapper>\n);\n",
"branch": {
"draft": null
}
}
}
}
}
}