Skip to content

Ai seeder#39

Merged
mas-iota merged 12 commits intomasterfrom
ai-seeder
Sep 5, 2023
Merged

Ai seeder#39
mas-iota merged 12 commits intomasterfrom
ai-seeder

Conversation

@mas-iota
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor Author

@mas-iota mas-iota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request Changes

);
};

saveSampleAiData = (state, type) => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset? true | false
Function name -> onSaveAIData

Investigate if we can import the state parameters pass folders/images from that state, {images, folders}

if ((images && images.length) || (folders && folders.length) ) {
this.setState(() => ({ images, folders, originalState, loaded: true }));
}
else
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guard the else with brackets

Comment thread src/control/content/containers/Home.js Outdated

/** UTILS */
const checkImageUrl = (url) => {
const optimisedURL = url.replace('1080x720', '300x300');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smaller is better

Comment thread src/control/content/containers/Home.js Outdated
const xhr = new XMLHttpRequest();
xhr.open("GET", optimisedURL);
xhr.onerror = (error) => {
console.error('provided URL is not a valid image', error);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, console.warn

Comment thread src/control/content/containers/Home.js Outdated
};

/** UTILS */
const checkImageUrl = (url) => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elimanateNotFoundImages()

Comment thread src/control/content/containers/Home.js Outdated
let processedImages = items.map(
({ naturalWidth, naturalHeight, originalSrc }) => {
return new Img({
src: originalSrc,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the fetched URLs

Comment thread src/control/content/containers/Home.js Outdated
});
}

Promise.all(promises).then(items => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise.allSettled()

Comment thread src/control/content/containers/Home.js Outdated
+ 'Weather:https://source.unsplash.com/featured/?rainy\n'
+ 'City:https://source.unsplash.com/featured/?street',
systemMessage: 'Each row contains a folder and image URL that should belong to. if nothing provided or no URLs provided then return null',
maxRecords: 10,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it 25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made it 5 after testing, it's the most stable choice

@mas-iota mas-iota merged commit c17bfa5 into master Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants