this post was submitted on 16 Feb 2024
11 points (92.3% liked)

chat

8151 readers
2 users here now

Chat is a text only community for casual conversation, please keep shitposting to the absolute minimum. This is intended to be a separate space from c/chapotraphouse or the daily megathread. Chat does this by being a long-form community where topics will remain from day to day unlike the megathread, and it is distinct from c/chapotraphouse in that we ask you to engage in this community in a genuine way. Please keep shitposting, bits, and irony to a minimum.

As with all communities posts need to abide by the code of conduct, additionally moderators will remove any posts or comments deemed to be inappropriate.

Thank you and happy chatting!

founded 4 years ago
MODERATORS
 

I know the party line is to hate AI but y'all are simply wrong about this.

you are viewing a single comment's thread
view the rest of the comments
[–] FuckyWucky@hexbear.net 3 points 2 years ago* (last edited 2 years ago)

im kinda mixed centrist on this. its good for certain tasks, ive made scripts and smaller programs with it but its not a replacement for humans or human creativity and shouldnt be treated as such. of course, this is capitalism so...

examplei asked it to make a script to scrape all my comments on hexbear and write to a file, it did it without issues as the json structure was provided.

example 2i asked it to make a script to allow me to hide posts on hexbear/lemmy and it came up with a working one after 2-3 iterations

spoiler spoiler // ==UserScript== // @name Hexbear Hide Posts // @namespace http://tampermonkey.net/ // @version 1.0 // @description Hide posts on hexbear.net and store their state in local storage // @author You // @match https://hexbear.net/* // @grant none // @run-at document-end // ==/UserScript==

(function() { 'use strict';

// Function to create and return a 'Hide' button element
function createHideButton(postHref) {
    let btn = document.createElement('button');
    btn.innerHTML = 'Hide';
    btn.className = 'btn btn-sm btn-link btn-animate text-muted py-0';
    btn.style.marginLeft = '5px';
    btn.addEventListener('click', function () {
        // Find the closest post container to the button clicked
        const postElement = this.closest('div.post-listing') || this.closest('article');
        if (postElement) {
            hidePost(postElement, postHref);
        }
    });
    return btn;
}

// Function to hide the post and save its href in local storage
function hidePost(postElement, postHref) {
    postElement.style.display = 'none'; // Hide the post
    localStorage.setItem('hidden-' + postHref, 'true'); // Mark the post as hidden in local storage
}

// Function to process and potentially hide a post
function processPost(post) {
    // Use the href attribute of the first anchor tag within the post as a unique identifier
    const postHref = post.querySelector('a').getAttribute('href');

    // Check if the post is already marked as hidden in local storage
    if (localStorage.getItem('hidden-' + postHref) === 'true') {
        post.style.display = 'none'; // Hide the post if it was previously hidden
    }

    // Find the dropdown button to insert the 'Hide' button after
    const dropdown = post.querySelector('[data-bs-toggle="dropdown"]');
    if (dropdown) {
        const hideButton = createHideButton(postHref);
        dropdown.parentNode.insertBefore(hideButton, dropdown.nextSibling);
    }
}

// MutationObserver callback to watch for changes in the DOM
const observerCallback = (mutationsList, observer) => {
    for (const mutation of mutationsList) {
        if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === Node.ELEMENT_NODE) {
                    // Check if the added node is a post container
                    if (node.matches('div.post-listing, article.post-container')) {
                        processPost(node);
                    } else {
                        // Check if any child nodes are post containers
                        const postNodes = node.querySelectorAll('div.post-listing, article.post-container');
                        postNodes.forEach(processPost);
                    }
                }
            });
        }
    }
};

// Set up the MutationObserver to watch for changes in the entire document
const observer = new MutationObserver(observerCallback);
const config = { childList: true, subtree: true };

// Start observing the document
observer.observe(document.documentElement, config);

// Additionally, process any posts that are already in the DOM at script start
document.querySelectorAll('div.post-listing, article.post-container').forEach(processPost);

})(); :::

i think for creative tasks like writing, relying on LLMs entirely is just lazy and you can see that with AI Content farms on youtube.