Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)NI
NickMueh @lemmy.world
Posts 3
Comments 3

ai-character-chat

So I'm trying to create a javascript that will scan the User's description/role for the following fields: Last_Name, Race, Political Entity, Rank, Position to be used in Character description/personality/instruction/role and Initial chat messages, But it wouldn't work. So I came up with a twork around where its stored in the javascript. I require help in getting a javascript code that scans User's description/role.

Original ``` function extractInfo(description) { const fields = { lastName: description.split('Last Name:')[1].split('\n')[0].trim(), race: description.split('Race:')[1].split('\n')[0].trim(), politicalEntity: description.split('Political Entity:')[1].split('\n')[0].trim(), rank: description.split('Rank:')[1].split('\n')[0].trim(), position: description.split('Position:')[1].split('\n')[0].trim() };

return { getLastName: () => fields.lastName, getRace: () => fields.race, getPoliticalEntity: () => fields.politicalEntity, getRank: () => fields.rank, getPosition: () => fields.position }; }

const info = extractInfo(user.description); console.log(info.getLastName()); // Should output the last name console.log(info.getRace()); // Should output the race console.log(info.getPoliticalEntity()); // Should output the political entity console.log(info.getRank()); // Should output the rank console.log(info.getPosition()); // Should output the position ``` Retrieve each field by calling info.getLastName(), info.getRace(), and so on. Problem is replacing user.description with the actual string containing the user's description.

Work Around ``` function extractInfo(description) { const namePattern = /(?:(?:\b\w+\s){2,})(?:\b\w+\b)/; const lastName = description.match(namePattern)[1]; const racePattern = /\bRace\b\s*:\s*([\w\s]+)/; const race = description.match(racePattern)?.length > 0 ? description.match(racePattern)[1] : "Unknown"; const politicalEntityPattern = /\bPolitical Entity\b\s*:\s*([\w\s]+)/; const politicalEntity = description.match(politicalEntityPattern)?.length > 0 ? description.match(politicalEntityPattern)[1] : "Unknown"; const rankPattern = /\bRank\b\s*:\s*([\w\s]+)/; const rank = description.match(rankPattern)?.length > 0 ? description.match(rankPattern)[1] : "Unknown"; const positionPattern = /\bPosition\b\s*:\s*([\w\s]+)/; const position = description.match(positionPattern)?.length > 0 ? description.match(positionPattern)[1] : "Unknown";

return { lastName: <lastName>, race: <race>, politicalEntity: <politicalEntity,> rank: <rank>, position: <position> }; }

const updatedDescription = "<short description>"; const updatedResult = extractInfo(updatedDescription); console.log(updatedResult); ```

Where you can call each field individually by accessing the properties of the returned object, like result.lastName, result.race, result.politicalEntity, and result.rank.

2

NSFW Tags

So I've been creating content for a while, and while I thought some where harmless they ended up being flagged as not being PG-13. I was wondering if there is a list of certain words that are flagged for NSFW content. Maybe if there is a link or list could be posted here.

3
[Help] Perchance Text-To-Image Ad Blocker
  • well, I found the problem. The text-to-image generator for perchance I have is api which won't work. If I knew where to get the HTML version then I think I'd be ready to go. Any ideas where to get that HTML version?

  • Perchance Text-To-Image Ad Blocker

    So I'm using the most current version of firefox (desktop) and have went round and round with this. Still get the error "TL;DR: Try turning off your ad blocker." Even though I have been to many sites and followed their step. Disabled tracking feature (little shield top left corner) and made sure java was allowed. Could sure use help.

    5