-
Notifications
You must be signed in to change notification settings - Fork 3
Fix/health job #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sfreeman422
wants to merge
168
commits into
sfreeman422:master
Choose a base branch
from
dev-chat:fix/health-job
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix/health job #33
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Remove Spam From Muzzled Users (#5) * Removed unnecessary console log * Converted muzzled array to a Map and added a muzzlers Map to track requestors. Added corresponding tests * Added error strings to tests * Removed isMuzzled references in favor of muzzled.has * Removed unnecessary types * Added a 10 message limit to muzzled users * Adjusted linting options in package.json * Added precommit linting for tests also * Changed MAX_SUPPRESIONS to 7 * Bumps Axios to 0.18.1 (#6) * Bumps axios to avoid security vulnerabilities * adjusted package-lock.json * Added muzzle cooldown and tests (#7) * Max Muzzles Per Hour (#8) * Added max muzzles per hour feature * Converted to window.setTimeout and window.clearTimeout * Added proper types to take advantage of NodeJS.Timeout * Added tests for removeMuzzler * Feature/max muzzles per hour (#9) * Converted to window.setTimeout and window.clearTimeout * Added proper types to take advantage of NodeJS.Timeout * Fixed muzzle max issue * Fixed a regression in defin in which no response was being sent (#10) * Fix a bug with muzzle removal (#11) * added timeout for muzzle removal * Added timeout amount * Added fix for removal function (#12) * Added fit for removal function (#13)
* Removed try catach block for addUserToMuzzled * Added lolex to successfully mock setTimeout in tests * Added lolex cleanup * Route cleanup * Updated describe blocks to reflect reject rather than throw
* Added ability to block bot_message from muzzled users. Also moved code from route to utils re: sendMessage and deleteMessage * Changed to reference the proper authed_users * Fixed log * Adjusted logging * Added comments and moved WebClient initialization into muzzle-utils * Fixed an issue in which muzzles were getting delted while a person was muzzled * Added comments
* Added 30 second retry for deleted items * Adjusted timeout * Added error handling that ignores when a message is not found * Adjusted retry time to 5 seconds
* Added better userId and userName retrieval as well as ability to block gif * Removed unnecessary export added logging * Added proper resp.members * Added support for other bots and better logging * Adjusted tests. Still failing due to a lack of proper mock. TODO * Added test function to slack-utils and fixed up tests
* Refactored muzzle-route and muzzle-utils * Changed muzzlers map to requestors for better clarity * Added support for @here
* Added removalFn as a property to muzzled users to allow tracking and moved setMuzzlerCount outside of muzzleUser * Adjusted timeout * Added containsAt and addMuzzleTime functions * Exported ABUSE_PENALTY_TIME * Adjusted getRemainingTime function * Added addMuzzleTime interaction with muzzled map * Added a setTimout to alerting channel about user tags * Adjusted wording of alert * Added siren emoji * Adjusted shortcircuit on shouldBotMessageBeMuzzled * Added logging on addMuzzleTime * Adjusted getUserId * Fixed getRemainingTime to return ms not s * Added logging for getRemainingTime * Added 1000x multiplier on process.uptime() for ms * Removed logging for getRemainingTime and changed emoji to rotating_light
* Added better handling of userId inside of shouldBotMessageBeMuzzled * Added ternary for userIdByAttachment * Added logging * Added some pretty terrible logic to shouldBotMessageBeMuzzled as PoC * Changed userId to any termporarily * Added better check on attachments * Added logging to handle route * More maddening logic for handling spoilers * Added callback ID logging * Adjusted logic for userIdByCallbackId * Adjusted index for callback id * Removed excessive logging and moved spoiler logic out
* Added typeorm, mysql driver, and tsconfig options to make use of typeorm * Renamed server.ts to index.ts and adjusted package.json * Added User and Muzzle models * Added relationship information to to USer and Muzzle classes * Added some base functions for interaction with mysql db via typeorm * Added logging * logged results * Changed addUserToMuzzled to be async * Added resolve/reject to inner then of addMuzzleTransaction * Adjusted addMuzzleToTransaction call in muzzle-utils * Reverted to try/catch * Changed date type to play nice with mysql datetime * Added date property on insert * Removed User since it is not necessary * Added log on db insert * Changed a failed DB add to resolve with a warning rather than reject * Added default date value and changed time to muzzleLengthMs * Changed to milliseconds * Added createdAt and updatedAt fields * Added suppression counters to the db * Added id to updateSuppressions as well as logging * Separated updateSuppressions into two separate increment functions * Removed old updateSuppressions import * Added tracking for deleted messages after a user reaches their max muzzles * Added support for incrementing muzzletime * Adjusted order of operations on containsTag * Added logging to containsTag * Changed contains tag to check an entire sentence not just a single word * Changed verbiage and handling of tags while muzzled to delete messages and not muzzle * Changed the muzzle to fail on issues with DB * Removed get functions from muzzle-actions. These will be addressed independent of saving data * Removed async on sendMuzzledMessage since it is no longer necessary * Converted from ormconfig.json to ormconfig.ts, added logging and updated gitignore * Converted from transactionId to muzzleId * Removed try catch in favor of catch * Replaced addMuzzleTransaction with addMuzzleToDb * Better naming * Added change to make addMuzzleTime more generic
* Changed define route to avoid unnecessarily calling the API if a user is muzzled * Added comments to muzzle-utils, renamed removeMuzzler to removeRequestor and optimized trackDeletedMessage * Moved some of the muzzle code out into a separate utilities file to make muzzle more readable * Separated out muzzle-utilties and muzzle tests * added additional testing to getTimeString * Removed direct references to muzzled * Adjusted comments
* Added testdouble as a dev-dependency * Converted to use jest rather than mocha/chai for tests * Moved jest and typescript to dev-dependencies * Removed accidental save-dev dependency * Converted muzzle-utils to muzzle service and created web-client-service * Converted slack-utils to slack.service and slack.service.spec * Converted to SlackService * Completed conversion from utils to classes and renamed from utils -> services, and routes -> controllers * Converted to singleton classes for all service * Added more tests for slackService * Added tests for defineService * mock-utils -> mock.service and corresponding tests * Added simple tests for WebService * Moved db calls to muzzle persistence service * Added mocks to muzzle.service.spec * Removed lolex dependency
* Added more tests to muzzle.service * Fixed empty block
* added stats route and mostMuzzledByInstances * Added logging * Adjusted getMostMuzzledByInstances() * Consolidated getMostMuzzledByInstances * Changes to getMostMuzzledByInstances * Changes to getMostMuzzledByInstances * Added orderBy * Added descending count * Added getMostMuzzledByWords * Adjusted params in getMostMuzzledByWords * Adjusted params in getMostMuzzledByWords * Summed the wordsSuppressed field * Summed the wordsSuppressed field * Summed the wordsSuppressed field * Summed the wordsSuppressed field * Removed groupBy for wordsSuppressed * Added getMostMuzzledByChars * Added getMostMuzzledByTime * Added getMostMuzzledByMessages * Added muzzler request data * Fixed typo * Fixed naming * Added prelim kdr implementation * Adjustment to KDR * Changes to KDR * Changes to KDR * Changes to KDR * Changes to KDR * Changes to KDR * Changes to KDR * Changes to KDR * Changes to KDR * Fixed invalid sql statements * Added await * Consolidated kill and deaths to kdr * Adjusted divison * Adjusted divison * Fixed typo * Fixed typo * Adjusted getKdr to perform count division on one line * added casting to decimal * Casted only the divisor * Casted only the divisor * Removed unnecessary async await * Testing diff decimal * Testing result of select call * Testing result of select call * Testing result of select call * Testing total count * Converted to using SUM * Added kills and deaths to KDR key * Added case statement * Added if statement * Changed null to 0 * Added nemesis * Changed nemesis * Changed groupBy for nemesis * Changed groupBy for nemesis * Changed groupBy to addOrderBy * Removed addOrderBy * Added naming for nemesis * Added max count * Changed groupBy * Reverted max change * Added limit * Changed order of limit * Changed order of limit again * Swapped out typeOrm calls for custom mysql query * Adjusted custom mysql query * Reverting to typeorm methods * Converting to a raw sql query * Adjusted query and commented out the typeorm calls * Added distinct * Adjusted distinct * Distinct changes * Added custom sql query * Added nemesis sql query * Added name for count * Added some mild formatting * Added kdr and nemesis to report * Forced controller to send back report: * Removed table import * Added tables * Returning report * Adjusted how we handle cli-table builds * Fixed typo * Fixed typo * Removed TH headings * Converted to post route * Enabled slack message * Converted to use easy-table instead * Added backticks * Added better formatting * Adjusted SQL queries to be more easy to manage * Backed out sql changes and did formatting in the code
* Fixed formatting * Added type
… for clap and mock (#30)
* Removed unnecessary logging * Converted to uploading a file rather than sending a message * Removed unused import * Removed filename attribute * Added logging * Added initial comment * Added loging for body * Passed in proper Id * Added markdown formatting * Added better formatting * Removed formatting * Formatting * More formatting * removed markdown formatting * Added botuser token
* Separated out kdr and accuracy * Added support for KDR and accuracy on the report * Fixed typo * fixed other typo * Removed KDR calculation in getKdr temporarily * Added groupBy * Broke out into custom sql query * Fixed typo * Adjusted query' * Adjusted query * Adjusted query * Remove ambiguity * Added a.count = b.count * Added logging * Adjused sql * SQL query * Query * Query * SQl adjustment * Added proper sql query * Adjusted naming in report.service * adjust kdr to be calculated in sql * Added order by kdr * Adjusted successfulMuzzles to reflect the right value * Adjusted deaths to reflect the right value * Adjusted naming on report * Added nemesis by raw and by successful
* Removed last clap and support for clapping one word only * Adjusted sql queries to be more direct * Fixed naming added logging * Adjusted sql query to better support date range * Dates will be treated as strings in sql * Fixed invalid sql syntax * Fixed invalid KDR calculation for time based reporting * Added error handling for invalid types * Added formatting on error handling * Added better reporting titles * Fixed overflow error * Added allowance for non-param requested reports to default to AllTime * Fixed empty string check * Further logic tweak * Adjusted titling * Added better testing for report.service * Adjusted formatting of tables * Added a default to 1 when calculating KDR and a user has no deaths * Formatting * Fixed KDR calculation * Debugging mysql divide by 0 * Adjusted created at in kdr * Removed verbose logging on web.service.ts * Added log on getKdr to figure out issue with query * Fixed KDR bug * Removed the query log * Cleaned up muzzle report formatting * Further cleanup of report and logging
* Added confession controller * Updated route name for confession controller
* Added model for List * Added a super basic controller and service * Added report for list * Fixed username * Added some slight error handling to remove * Added removal by text instead of ID and adjusted report to have better naming * Added limit on characters when adding items * Fixed error text for list removal * Adjusted message format for adding and removing from the list * Verbiage adjustments
…her than start of week (#124)
* Refactor phase 1 of shouldBotMessageBeMuzzled * Added userIdByBlocksSpoiler to designate spoiler specific userIds * Added logs to getBotId * Changed getUserId to return undefined when a user is not found * Fixed returning an empty string from getUserId and removed unnecessary logs * Added log for muzzles inside of shouldBackfire due to suspicions around max percent change * Added caching to getAllUsers and added logs of each request * Fixed import * Added better backfireId handling * Added fixes for type coercion regarding string to numbers * One more type coercion fix for sendMuzzledMessge * cleaned up ugly code in reaction.persistence * Added catchs to webClient interactions to avoid JP from breaking things * Added ? to request.event.blocks.length in shouldBotMessageBeMuzzled
* Added support for AI text generation via OpenAI * Added log for ai generated text * Upgraded davinci model and removed temperature parameter * Added max_tokens param * Added message indicating that request is being processed * Added safeguard to only allow one inflight request at a time per user * Added markdown to represent block of text * Removed extra backtick * Removed first 2 \n characters * Fixed formatting * Formatting fixes * Removed formatting since it is not reliable * Added .trim() call * Added support for image generation * Fixed bad block format * Added better error handling * Fixed permanent inflightRequests if generateImage failed * Added ephemeral messaging for failure * Made images smaller * Added backticks to error messages * Fixed bug in catch for generateText * Updated to limit AI requests to 7 per day per user
* Consolidated buy and use into buy workflow * Removed all Inventory and InventoryItem related logic * Updated DB_ITEM_SEED to include Moon Token * Added support for Moon Tokens * Updated checks and effect removal from ai related routes * Updated pricing job to include auth_plugin field * Updated text for store * add logs * added logs for isNaN and isFinite * removed logs and fixed bug with Number.isFinite * Removed additional unnecessary log * Fixed bug in which we referenced request.text instead of itemId * Added logs for itemById and userById * Added return to buyItem * Added logic to use an item before purchasing so that we can effectively buy/use at same time without accidentally spending money for no reason * Added support for effects that do not have an expiry * Moved request log * Fixed itemId * Fixed bad itemId references * Changed rep calculations and moved a lot of db logic into reaction.persistence.service. Also changed Rep table to only track how many times a user checks their rep * Replaced refernces to defunct functions * Removed bad reference to reactionPersistenceService in storePersistenceService * Fixed bad function call to removeReaction * Added log for rep * Added support for queries * modified purchase table to use slackId * Removed bad import * Changed user type to string for Purchase * Changed to use string * fixed references to old purchase user.id * Added fixes to getRepByUser * Fixed query * fixed is not opperator * Fixed getSentiment * Commented out code in the pricing-job so that it would not run. It was no longer correct based on changes to purchase and rep tables * Updated TODO * Added Da Bros Stimulus Package December 2022 to the report * Changed name to Stimulus - Dec 2022 * Abbreviated december * Added query to get all earned rep * Modified script to properly find job * Began mapping for totalEarnedRep * Added ability to get repSpent and derive available rep and add to repMap * Fixed typo * Added log for totalRepSpent * Added mycursor.execute * Fixed typo * added sort to repMap * Added calculation for median index * Added math.floor to get lower of two values if necessary * Added retrival of medianIdx * Added retrieval of tuple value * Added price logic * Added proper value for calculation * removed comments and unnecessary logs * Updated TODO * Feature/upload images (#128) * Added code to test uploading images * Removed bad import * Added images directory * Fixed typo * Capitalized Authorization * Changed to body instead of { body } * Added cal to completeUploadExternal and logging * Fixed linting error * Added files info call * Consolidated into awaits * Uncommented controller code * Changed sendMessage to use MUZZLE_BOT_TOKEN * Reverted to using MUZZLE_BOT_USER_TOKEN and added additional error logging * added log for fileinfo.fille * Changed to use permalink * Added first pass at using imgur * removed bad imports * Removed unnecessary code and unnecessary packages * Removed unnecessary code and imports
* Added trends to the fun-fact-job * Fixed url for getTrends * Adde log * added log for trends * Added trends * Added WOEID for USA instead of NYC * Added support for On This Day from wikipedia * Temporarily set channel to testbotz * Added str to month and day * Reconfigured the otd section * Fixed typo * Removed actions in favor of inline link * removed elements array * Changed testbotz back to general * Removed trends * Added daily joke section * temporarily set post to testbotz * Fixed typo * Removed italics * Updated create-database, filtered for duplicates on joke as well * Fixed typo * Added str() for id * Added some logs * added print for str(id) * Added parens * Added missing comma * Fixed missing param on sendSlackmessage * Switched back to #general * Moved api calls into main and passed as params to sendSlackMessage * Changed to #testbotz for final test * Changed back to #general * updated create-database * Added message for failure on slack sendMessage * Made sendMessage throw * Removed private channel suggestion * Fixed error message * Removed finally lock since it was silencing errors and error handling in ai.controller * added remove inflight to ai.service * Updated OTD to handle missing image * Fixed bad suntax * Added log for firstPage * changed to use .get() * added support for gpt-3.5-turbo to save costs * added user to chat calls for better feedback'
* Added trends to the fun-fact-job * Fixed url for getTrends * Adde log * added log for trends * Added trends * Added WOEID for USA instead of NYC * Added support for On This Day from wikipedia * Temporarily set channel to testbotz * Added str to month and day * Reconfigured the otd section * Fixed typo * Removed actions in favor of inline link * removed elements array * Changed testbotz back to general * Removed trends * Added daily joke section * temporarily set post to testbotz * Fixed typo * Removed italics * Updated create-database, filtered for duplicates on joke as well * Fixed typo * Added str() for id * Added some logs * added print for str(id) * Added parens * Added missing comma * Fixed missing param on sendSlackmessage * Switched back to #general * Moved api calls into main and passed as params to sendSlackMessage * Changed to #testbotz for final test * Changed back to #general * updated create-database * Added message for failure on slack sendMessage * Made sendMessage throw * Removed private channel suggestion * Fixed error message * Removed finally lock since it was silencing errors and error handling in ai.controller * added remove inflight to ai.service * Updated OTD to handle missing image * Fixed bad suntax * Added log for firstPage * changed to use .get() * added support for gpt-3.5-turbo to save costs * added user to chat calls for better feedback'
* Updated index.ts to allow for middlware pass on BLIND_TOKEN, updated controller to send message * added space in context * Updated text to include markdown code block * Commented out functional code in order to test in production * Imported blindController in index.controller * Uncommented so I can begin testing * Added a title, removed the context added a divider * Added ability to provide my own title * Added context back * Reformatted JR in the Blind to JR the Blind, added diff emojis * modified addUserToMuzzled so that JP gets muzzled everytime * JP will always backfire * JP will actually always backfire * Added log for logActivity * Added bandaid to avoid workflows from breaking the service * started work on history job + added /history-upload-job/data to gitignore
* Added chunks for blocks * Fixed chunk: * Added shitty logs * Fixed chunking to account for backtick characters * Removed formatted blocks in favor of plain text * Push the section * Fixed text limit to match schema requirements * AIO section * added better chunking
* Added logs * Fixed chunking * Added a log to understand chunk length * Added log of blocks * Upped AI requests to 10 per day
* Added support for dalle-3 * Upped size * Reduced size * Added support for using imgBB * Updated expire to 30 days * Perma muzzled JP * Actually muzzled him * Logged event type * logging event * logging request
* Added code to write to disk and return an image * Fixed path * Removed imgBB Call * Removed code for uploading to 3rd party image hosts
* WIP code for handling impersonation * Added permamuzzle function, need to compelte * Removed logic to always backfire for JP, ignored user_profile_changed events, increased chance of backfire by 10% per muzzle * Added permamuzzle on impersonation feature * Removed bad imports * Added health controller and started health job * Removed history-upload job * Added healthcheck and job * Removed JP from isMuzzled * Removed logSentiment call on profile change * added log for isUserProfileChanged only * logs * small changes that wont fix anything * Fixed bad event * Fixed removePermaMuzzle call * Removed JP hardcode isSuppressed * Fixed case sensitive getImpersonatedUser * Added early work on health job * Fixed bad deletion * Fixed bad deletion * Added health-job * chmod +x on script.sh * Added log for health * Changed python_version=3.8 * Added pipfile.lock * Added localhost url * Added exception for localhost in signatureVerification * Localhost -> 127.0.0.1 * Added explicit error handling
* Added Message table: * Added handler for storing activity * Added support for summarization via openAI * Removed unnecessary logs * Fixed bad sql for message * Fixed hostname on middleware * Adjusted verbiage on theh summary message * Changed python job to reference #muzzlefeedback instead of #general * Changed from ASC to DESC for history order * Added filtering for muzzle user * changed column to text for message * Modified the getHistory function to return last 100 messages only * tweaked the ai prompt * Fixed getHistory to grab latest 100 messages * Changed AI query * Updated logic for determining whether a user is being impersonated
* Upgrade ioredis, typeorm and added dotenv * Various lint fixes * Modified query to grab either all messages from last hour or last 100 messages * Modified query * Modified summary query to grab last 100 or last hour messages, whichever is greater * Fixed sql param passing * Modified query to share specific funny or interesting messages * Further modification of summary prompt * Modified summary to be 5 sentences and quips * Prompt engineering * More prompt engineering * Prompt engineering * Added endpoints and supporting service and persistence service changes to support daily summaries * Added proper redis key PX * upgrade gpt-4 model * Changed icons * Added daily limit handling * Changed verbiage * Updated the prompt * Updated prompt * Added await to setHasUsedSummary, modified setHasUsedSummary to use the right enum * Adde terrible logs * Changed and to or * Added retry logic to the health job in hopes of reducing false positives * Downgraded to gpt-4 model and removed token limit * Upgraded to turbo preview * Added log for history * Added prompt with history * changed endpoint name * Removed limit on prompt-with-history * Removed broken code * Enabled prompt-with-history for everyone except JP * Changed the title text for prompt-with-history:
* Got data and models set up, need to format message properly * Added quote * Added hacky agent deal * Removed https import * Added code to get latest quote properly * Formatting * Converted to using finnhub * Added market cap expressed as billions * Removed decimal from market cap, added log for response * upper cased the ticker cuz finnhub cares for some reason * Sent 200 earlier to avoid erroneous failure text in slack * Added 52week high and low * Adjusted order of block' * Updated context date to be user specific * Adde verbatim false * OPtional all the things * Added backup text to context * Added check for 4 character ticker * Added encodeURI to all uris * Fixed getPlusOrMinus * Added name, removed bad negative * fixed missing name issue * Added log for company data * Modified all calls to retreive from finnhub * Fixed market cap * Logged quote * Expressed market cap in trillions * Added toFixed(2) for marketcap * Math * Added B * More calcs * Changed divisor * Added support for previous close and day change * Fixed dayChangePercent * Changes to response obj * Adjusted shareoutstanding number properly * More market cap fxies * Changed verbiage in message * Adjusted context * Removed timestamp from context * Added formatting for asterisks * Added formatting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.