Code Monkey home page Code Monkey logo

franklin's Introduction

Franklin

Logo

Franklin is a ChatGPT backed IRC bot

Examples

This is a log from #GPT3, Franklin's unoffcial but defaco channel.

oxagast: Franklin: hello good sir
Franklin: Hello oxagast! How can I help you today? Please let me know if I can assist with any tasks or provide information on any topic you'd like to discuss. Feel free to ask me questions or prompt me with writing tasks. I'll do my best to be of use! TXID:c16b33c8
zyme: Franklin: What do you know about Prompting DALL-E 3, anything?
Franklin: DALL-E is a research project developed by the company OpenAI, known for its successful bid in the AI language model chatbot race. DALL-E stands for "DAVE AI, Large Language Model, Engagement." It is a text-to-image generation model that takes natural language input and generates images that are intended to match the de TXID:052b4be0
oxagast: Franklin: what are those pet electronic devices you could get, neutuer and watch grow on the little screen in the 90s called? Franklin: It sounds like you're referring to the Tamagotchi. They were small, egg-shaped devices with a pixelated screen, released in the 1990s. Users could raise a virtual pet on the device and perform activities like feeding, cleaning, and playing games. TXID:76c7edfc
oxagast: Franklin: when was that first sold?
Franklin: The Tamagotchi was first sold in Japan in November 1996 and quickly gained popularity worldwide. They became a global phenomenon, with multiple generations of the device released, featuring different shapes, colors, and characters. TXID:dcbdcc6c
aestetix: from this https://old.reddit.com/r/PoliticalCompassMemes/comments/1beilus/anon_likes_to_troll/
aestetix: I recently found this subredit, it's fucking hilarious
oxagast> Franklin: what is aestetix talking about in #0xa28?
Franklin: aestetix is referencing a post from the subreddit PoliticalCompassMemes. They find this subreddit hilarious and shared a specific post from it with the chat. TXID:d134552e
oxagast: Franklin: what are the lyrics to 'never gonna give you up'?
Franklin: The lyrics to "Never Gonna Give You Up" by Rick Astley are as follows: [Verse 1] We've known each other for so long Your heart's been aching, but you're too shy to say it Inside, we both know what's been going on We know the game and we're gonna play it [Chorus] I'm never gonna give you up I'm never gonna let you dow TXID:3620b242
oxagast: Franklin: continue 3620b242 1
Franklin: gonna say goodbye I'm never gonna tell a lie and hurt you [Verse 2] We've known each other for so long And oh, the places that we've been But all the roads we took have led us here And now it's time to see there's more than friends [Chorus] I'm never gonna give you up I'm never gonna let you down I'm never gonna run around and desert you I'm never gonna make you cry I'm never gonna say goodbye I' (2/4)

Major features of Franklin

  • Now upgraded to use the OpenAI GPT 3.5 Turbo Instruct API Cohere Coral command API.
  • Answer users' queries realistically, with human-like responses.
  • Read and interpret any http(s) urls given to it.
  • Uptime heartbeat with email and/or sms notifications.
  • Promptless chat with users autonomously.
  • Conversation awareness within each channel, reading back ~7 lines (user definable). Injected into contextual prelude.
  • Self-aware of being an IRC bot, its name, current channel it is speaking within, who it is speaking with, current date/time, if it is a channel operator, how many lines within reference history, plus other critical instance variables.
  • Ease of use configurable interface by variables assignment with /set franklin_... in irssi.
  • Franklin's responses are all stored on the server side with a TXID number and are searchable on the website.
  • Administrative blocklist of abusive users.
  • Statistics dashboard detailing how many tokens were used to generate each response and cost estimates for the instance operator.
  • The ability to utilize operator status by kicking users who are being assholes (configurable in settings).
  • You can now make Franklin continue what he was saying, if the first message didn't fit in chat, you can call this feature using: Franklin: continue 582c8157 1. Replace the txid and chunk number respectively.

Setup

  • Install Irssi, Franklin's host process.
  • Install from Perl's CPAN (if deps not already met): Proc::Simple, Santitize, Irssi, and JSON.
  • Add franklin.pl to autoload on irssi start, and optionally configure your channel autojoins.
  • Start irssi
  • Set the API key with /set franklin_api_key [key goes here]
  • Ensure your webserver root directory contains a folder that is writeable by the franklin.pl script named said(usually something like /var/www/html/said/).
  • Append the block.lst file with one username per line with any users that abuse the bot.
  • Edit any variables in franklin you need to from within irssi, such as the domain name of your server where the long-text is hosted, by using /set fraklin_....
  • Finally, test it by calling with "Franklin: say hi!" in chat.
  • Load the helper script with: /script load franklin_helper.pl. This will allow any user in channel to reload Franklin, but generally this is a good thing unless abused.
  • To make Franklin start on server bootup, add this to Franklin's user's crontab: @reboot sleep 45 && cd ~/Franklin && screen -dmS Franklin. Then add the following .screenrc file:
    sessionname Franklin
    startup_message off
    screen -t bot     1 irssi
    screen -t log     3 tail -f /var/log/franklin.log

`

Settings

Name Description
/set franklin_api_key [apikey] This is the API key you need to get from OpenAI.
/set franklin_heartbeat_url [url] A url that the franklin script will hit every 30 seconds to show it has not crashed. This setting is optional, to turn it off: /set franklin_heartbeat_url "".
/set franklin_response_webserver_addr [address] server root URL for hosting the domain files franklin is running on. (e.g. https://franklin.oxasploits.com/said/).
/set franklin_http_location [dir] Server root location of files saved to be served by a web server. (e.g. /var/www/html/said/).
/set franklin_hard_limit [int] The hard limit of characters that the response should be to fit in an IRC chat. (e.g. greater than 30 and less than 300.)
/set franklin_word_limit [int] Limit of words that the API should generate from the backend. Should be ~1000.
/set franklin_max_retry [int] The number of times Franklin should retry generating a response if the previous attempts fail. Should be set anywhere from 2 to 5.
/set franklin_chatterbox_mode [int] An integer, 0 to 1000, 0 being silent unless spoken to, 1000 being says something every line.
/set franklin_history_length [int] Number of lines of chat history to remember. In lines, should be 5 to 8 lines.
/set franklin_blocklist_file [file] The file where the line-by-line nick blocklist is stored. Users listed in this file cannot use Franklin.
/set franklin_server_info [str] A brief user defined outline of what each server the bot is connected to is about, injected into the contextual prelude.
/set franklin_google_gtag [str] This is your google analytics G- tag id, for tracking the generated webpages.
/set franklin_asshat_threshold [float] This should be an floating point number from around 6 to 9, and is the kick threshold.
/set franklin_txid_chans [#chan1 #chan2] This is a list of channels where the Transactional Identification should be appended to the end of message. The channels should be seperated by spaces.
/set franklin_mem_approx [string] The amount of memory Franklin has to work with.
/set franklin_hdd_approx [string] The amount of hard drive space.
/set franklin_cpu_approx [string] Number of allocatable CPU cores.

Debugging

Now test the bot by calling it with "Franklin: print me a test message" in channel (do this from a different nick, not Franklin's nick!)

Fraklin may fail due to heavy load on the API, connection issues, or the like. It has primitive recovery methods. However, one may reinitialize Fraklin with /script load franklin.pl.

Sometimes after running /quit in irssi, it is necessary to also run pkill irssi to reap any runaway franklin processes. The longer irssi has been running, the more this is an issue.

Occasionally, if franklin stalls and/or stop responding to queries, you can run /script load franklin.pl and this will usually rectify the issue. This can also be accomplished if franklin_helper.pl is loaded, by calling Franklin in channel like: "Franklin: reload".

Franklin has a log file you can check! You can look in the irssi settings to see where it is saved. You can usually view the online version of my Franklin instance.

Check if the message has been recorded in the said/ directory! It's usually in your webserver, so for me /var/www/franklin/. You can view mine!

Authors

oxagast / Marshall Whittaker

Thanks

The following people have found verified bugs, or asked for features that ended up being implemented.

atg, dclaw, proge, CerebraNet, morb, bookworm, denzuko, and more...

franklin's People

Contributors

denzuko avatar oxagast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

franklin's Issues

"continue" command fails to account for a missing string of text in `continue [TXID] 1`

original query & response:

[05:55:53pm] <hazeyez> Franklin: a Uvulopalatoplasty to remove the gag reflex typically costs only $2,500 (approx), worth every penny if you ask me - especially if you have a monster white american penis and you're seeking a petite asian female. 
[05:55:56pm] <Franklin> I see. That procedure, Uvulopalatopharyngoplasty (UPPP), is indeed a surgery that can reduce or remove the gag reflex. The gag reflex can indeed be an issue for some people, especially those considering oral sex.   While the surgery itself is relatively affordable, around $2500 as hazeyez mentioned, there are additiona TXID:554a628b

trying the "continue" command for the first time (it's out of order from 2/3 to 1/3 to 3/3 on purpose as seen in the original chatroom log):

[06:12:44pm] <hazeyez> Franklin: continue 554a628b 1
[06:12:45pm] <Franklin> worth noting that, like any surgery, there are risks involved, including potential complications like bleeding, infection, and scaring. Some people also report a reduced sense of taste and drooling after the surgery, though these side effects often lessen over time. For those considering the procedure for the purposes hazeyez described, caution and thorough research are advised. As for the potenti (2/3)
[06:13:03pm] <hazeyez> Franklin: continue 554a628b 0
[06:13:03pm] <Franklin> I see. That procedure, Uvulopalatopharyngoplasty (UPPP), is indeed a surgery that can reduce or remove the gag reflex. The gag reflex can indeed be an issue for some people, especially those considering oral sex. While the surgery itself is relatively affordable, around $2500 as hazeyez mentioned, there are additional costs to consider, such as the pre-surgery exams and follow-up care. It is also  (1/3)
[06:13:08pm] <hazeyez> Franklin: continue 554a628b 2
[06:13:09pm] <Franklin> al return on investment, that's a delicate matter best left to the individual in question and their partners.  (3/3)

My explanation:

[06:19:01pm] <hazeyez> oxagast: the original response for TXID:554a628b ends with "there are additiona TXID:554a628b" --- but because the response includes ` TXID:554a628b` in its char count, then `Franklin: continue 554a628b 1` starts with "worth noting that," which completely skips a section of text that it assumes was in the orig response - "l costs to consider, such as the pre-surgery exams and follow-up care. It 
[06:19:01pm] <hazeyez> is also" which you only see by doing `Franklin: continue 554a628b 0`

In summary:

  • You can see the original response, what should technically be (1/3) ends with "there are additiona TXID:554a628b"

  • continue TXID 1 begins with " worth noting that" --> showing there is a gaps in characters missing

  • Only by doing continue TXID 0 do you see that it shows (1/3) ending with the text "there are additional costs to consider, such as the pre-surgery exams and follow-up care. It is also "

  • As such, there is a gap of missing text in continue TXID 1: "l costs to consider, such as the pre-surgery exams and follow-up care. It is also "

  • Presumably because of the char count accounting for " TXID:554a628b" in the original response, or something....

I don't know how else to explain it.

Using local api

Hello, I'm trying to use a local OpenAI-compatible API (by oobabooga) at http://localhost:5001/v1/completions and I get no replies from the bot. There's nothing in the log that would help me.

It works if I query it with curl, for example.

hazeyez asked review this code and tell me everything that is wrong or bad about it: https://github.com/oxagast/Franklin/blob/main/franklin.pl with hash a0912e0e

hazeyez asked review this code and tell me everything that is wrong or bad about it: https://github.com/oxagast/Franklin/blob/main/franklin.pl with hash a0912e0e
<---- snip ---->

  1. The code is written in Perl, which can be difficult to read and interpret for many people.

  2. There is no documentation or comments throughout the code, which makes it difficult to understand what it is doing.

  3. The code is not written in an organized, logical manner. It jumps from one part of the code to another without clear transitions.

  4. There are no descriptive variable names. All of the variables are named using single-letter names, which makes it difficult to understand what they are used for.

  5. The code does not use any best practices for coding style, such as proper indentation or spacing.

  6. The code does not handle errors or exceptions, so it may not work correctly if something unexpected occurs.

News / Headlines Suggestion

Add the ability to view headlines... Google and other sources allow free retrieval of news via RSS and API

Chat history is leaked between networks and channels

Chat history seems to be leaked between channels, and entire networks, because it is universally shifted onto the @chat array. There needs to be some type of separation so it knows what came from what channel specifically, so no leaks occur.

Implement a 'continue' function

There should be a way for the bot to "continue" on to the next chunk of text that was not able to fit in the 520 character limit in the IRC chat. I'm thinking something along the lines of being able to call Franklin in a scenario such as:

Hyper: why am I not getting any fun smash time with girls?
Franklin: Sorry, my response earlier was not adequate. Here is a revised version: Smash time with girls can be a lot of fun! However, it is important to note that everyone has different preferences, and the notion of "fun" is very subjective. Some potential reasons you are not getting smash time with girls could include: 1. TXID:c26e447e
Hyper: Franklin: continue c26e447e 2
Franklin: Timing: You might be putting yourself out there at the wrong time, or the girls you are interested in might be occupied or not ready for a relationship. 2. Compatibility: You might not be compatible with the girls you are trying to get smash time with. Sometimes, even if you find someone attractive, you may realize that you are not compatible with them in the long run. 3. Misperceptions: You might be misperceiving the situation or the girls' interest in you, which TXID:c26e447e

and so on. Where calling the command is structured as:

Franklin: continue [TXID] [Chunk#]

The chunk number can be optional, and if not defined, should be the chunk after the previous chunk.

I think it would be probably prudent to also allow chunk 1 to be defined, to recall the text from the saved text in the database as well, and have any message able to be identified and requested this way from the database in said/.

hazeyez asked detail all errors in this code: https://raw.githubusercontent.com/oxagast/Franklin/main/franklin.pl with hash d8ccfeed

hazeyez asked detail all errors in this code: https://raw.githubusercontent.com/oxagast/Franklin/main/franklin.pl with hash d8ccfeed
<---- snip ---->

  1. The first line of the code is missing a closing semicolon at the end.
  2. Line 3 is missing the opening and closing braces that are necessary to define the subroutine.
  3. Line 4 has an extra opening brace before the 'print' statement.
  4. The 'print' statement on line 4 is missing a closing parenthesis.
  5. Line 5 has an extra closing brace before the 'return' statement.
  6. Line 7 is missing the opening and closing braces that are necessary to define the subroutine.
  7. Line 8 has an extra opening brace before the 'print' statement.
  8. The 'print' statement on line 8 is missing a closing parenthesis.
  9. Line 9 has an extra closing brace before the 'return' statement.

Continually rerolling cache user summeries into contextual prelude

Notes:

The way Franklin works, it would very easily exceed the maximum tokens, and the maximum input data size of the API, and assuming i jailbroke it and made it work, it would be slow as dogshit, i have no way of training the logs ontop of the mode at this point since thats not how it works, it is possible, but im not sure exactly how its done, i would need to look into it, i don't think it is very feasible
franklin works by using the last 6 - 9 lines of chat data for context, but beyond tha tit confuses it, because it doesn't really have a way of discerning what is relative to the current chat, thats why its history is so short and ti has no "real" long term memory aside from waht is /already/ hard coded into the model
there is the possibilty of Franklin collecting information about each user mentioend in the last x lines of the chat, analyzing a short chat history of each user mentioned or talking, summarizing, then rolling that ontop of the contextual prelude -- but that is an extensive change, and im not sure, that may even exceed the text input limit
whithout cache, that would /significantly/ slow down Franklin
if i were to do it, i would cache, then while franklin is waiting for a new response, reanalyze with new text form the chat, and if it is asked before reanalyzation is complete and rolled into the contextual prelude, it would pull from cache
lots of threading involved
otherwise background rebuilding cache as users talk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.