Skip to content
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

Priority Queue Implementation for Imogen #76

Closed
wants to merge 652 commits into from
Closed

Conversation

transfaeries
Copy link
Contributor

@transfaeries transfaeries commented Jan 11, 2022

To discuss and implement a paid priority queue for imogen.

I will write a possible spec for how it could work, and we can discuss it.

┆Issue is synchronized with this Asana task by Unito

@transfaeries transfaeries linked an issue Jan 11, 2022 that may be closed by this pull request
@transfaeries transfaeries removed a link to an issue Jan 11, 2022
@technillogue technillogue force-pushed the imogen-postgres branch 2 times, most recently from 819085b to 0900517 Compare January 21, 2022 06:43
Copy link
Contributor

@itdaniher itdaniher left a comment

Choose a reason for hiding this comment

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

Looks good overall; left a few comments. Didn't read imogen.py too deeply, assuming that it does what you need.

We probably want to make sure this doesn't conflict with any mobfriend behavior / assumptions made by other bots.

forest/core.py Outdated Show resolved Hide resolved
@@ -246,6 +264,10 @@ async def handle_auxincli_raw_line(self, line: str) -> None:
# maybe also send this to admin as a signal message
for _line in tb:
logging.error(_line)
if "sender keys" in blob["error"] and self.proc:
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 ? this needs comments explaining why, at least

Copy link
Contributor

Choose a reason for hiding this comment

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

i have absolutely no clue lol

Copy link
Contributor

Choose a reason for hiding this comment

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

ef491a7

i think there was some error about not being able to receive or find sender keys that made signal-cli hang

@@ -316,6 +338,12 @@ async def set_profile_auxin(
await self.auxincli_input_queue.put(rpc("setProfile", params, future_key))
return future_key

async def save_sent_message(self, rpc_id: str, params: dict[str, str]) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

does this work on auxin? should sent_messages be a pdict or otherwise persisted across resets?

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure why it wouldn't.

i don't actually need to this anymore because the important timestamps to match are in prompt_queue, beyond maybe keeping track of payments that were made

dunno if this is useful to anyone else, maybe i'll drop it

forest/core.py Outdated
return future_key

async def admin(self, msg: Response) -> None:
await self.send_message(utils.get_secret("ADMIN"), msg)
async def admin(self, msg: Response, **kwargs: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good; should this be blocked by SIGNAL=signal?

Copy link
Contributor

Choose a reason for hiding this comment

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

don't understand, isn't it?

forest/core.py Outdated Show resolved Hide resolved
forest/payments_monitor.py Outdated Show resolved Hide resolved
@@ -4,39 +4,35 @@ SHELL ["/usr/bin/bash", "-c"]
WORKDIR /app
RUN microdnf install -y git zlib-devel && rm -rf /var/cache/yum
RUN gu install native-image
RUN git clone --branch forest-fork https://github.com/forestcontact/signal-cli
RUN git clone --branch upstream https://github.com/forestcontact/signal-cli
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason not to swap this to asamk and use a tag?

Copy link
Contributor

Choose a reason for hiding this comment

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

can't push specific tags to asamk, came up when trying to pick the right senderkeys commit

imogen/imogen.py Outdated
@@ -217,6 +537,38 @@ async def do_c(self, msg: Message) -> str:
)
return response["choices"][0]["text"].strip()

@hide
async def do_ask(self, msg: Message) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

make this invoke the do_gpt handler?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah lol this is so stupid, i think the original point of this was that they had different stopwords, but stopwords don't seem to work with instruct-gpt anyway

imogen/imogen.py Outdated Show resolved Hide resolved
@@ -0,0 +1,48 @@
FROM ghcr.io/rust-lang/rust:nightly as builder
Copy link
Contributor

Choose a reason for hiding this comment

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

is purse used / working? or should this be a separate PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's used but not really working, i should probably fix it before merging this ig; imogen.py uses it

Comment on lines 59 to 103
def parse_text(self, text: str) -> None:
"set current self.text and tokenization to text"
try:
try:
arg0, maybe_json = self.text.split(" ", 1)
assert json.loads(self.text)
arg0, maybe_json = text.split(" ", 1)
assert json.loads(maybe_json)
self.tokens = maybe_json.split(" ")
except (json.JSONDecodeError, AssertionError):
# replace quote
clean_quote_text = self.text
clean_quote_text = text
for quote in unicode_quotes:
clean_quote_text.replace(quote, "'")
arg0, *self.tokens = shlex.split(clean_quote_text)
except ValueError:
arg0, *self.tokens = self.text.split(" ")
arg0, *self.tokens = text.split(" ")
Copy link
Contributor

Choose a reason for hiding this comment

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

@itdaniher , this is a questionable part of this pr

technillogue and others added 22 commits February 16, 2022 20:50
* add ask_intable and ask_floatable abstractions, do_challenge

* refactoring and cleanup to simplify out common patterns, also add a bunch of docs

* black

* missing bits

* lil more lint

* missing format

* lint

* black

Co-authored-by: infra <infra@sterile.solutions>
* adds kinda graphical captcha

* black

* Update Pipfile

* Don't require 3.8.

Co-authored-by: infra <infra@sterile.solutions>
Co-authored-by: infra <infra@sterile.solutions>
* port fixes and expansions from the hotline; add signalme, rot13, recipients-store parsing, better error handling to sending payments

* fixups

* add missing import

Co-authored-by: infra <infra@sterile.solutions>
* parens

* more detailed types

Co-authored-by: infra <infra@sterile.solutions>
* refactor load_secrets to make it easier to manipulate secrets files

* NO_DOWNLOAD->DOWNLOAD, NO_MEMFS->AUTOSAVE with `no` being the default. LOGLEVEL defaults to DEBUG. ROOT_DIR defaults to . if not DOWNLOAD

* cleanup, incorporating some changes from #26 / #108

* include gitignore, symlink dockerignore 

* fix moved imports

* fix githook instruction 

* try adding a unit test?

* nicer ci step names
* Changed get address to let you specify an FS_ACCOUNT NAME in secrets

* changed handle payment and payment response to move the default message to payment response

* changed the demo to be more straightforward

* added which envvars to set

* final version for the tutorial

* more stuff

* things changed cause black

* merge get_account_id_by_name and get_account, rename Mobster.get_address to get_my_address, add error handling in case of invalid FS_ACCOUNT_NAME, rename Bot.get_address to get_signalpay_address

* added a call that was missing

* made finished example match

* minor changes for consistency

* black

* s/get_address/get_signalpay_address/ in mobfriend and contact, a few simplifications and type fixes

* edited to pass linters

* fixed some more linter things, only on the code from this PR tho

* incorporated all comments from the PR

* black

* idk what's going on with mobfriend metrics

* fix missed changes

* remove references to changed flags and add a type hint to account_id

* Rename echopay_final.py to echopay_fully_implemented.py

* Rename echopay.py to echopay_template.py

* Rename echopay_fully_implemented.py to echopay.py

* add changelog notes

Co-authored-by: transfaeries <transfaeries@gmail.com>
Co-authored-by: infra <infra@sterile.solutions>
Co-authored-by: technillogue <technillogue@gmail.com>
Co-authored-by: itdaniher <itdaniher@gmail.com>
* stick SIGNAL_PATH with shutil.which in utils
* stick SIGNAL_PATH with shutil.which in utils

* fix
technillogue and others added 24 commits May 1, 2022 22:28
* writeup Imposter description and problem statement

* working config file, set in dev_secrets

* got dependencies working somehow

* update gitignore for poetry

* add typing notification

* respond to mentions or quotes

* add Ranker for examples and facts

* update for new ReaderAgent in personate

* add read_url command

* add emoji reacts and replies

* add acrossword dependency for serving local ranker

* fix group_id

* clean reply so we don't get chicken emoji

* add a bot that can track reply chains and reactions

* fix lints

* add sending quotes and a test command

* working MemoryBot implementation

* small fixes on imposter

* typing and refactor

* comments and docstrings

* pass correct bot

* give imposter a nemory

* comments on reply function

* get facts from conversation history

* replace example bot with PKD

* add installation instructions to README

* bump ci cache lock (#192)

* bump cache

* update deps

* update gitignore

* remove ipython dep

* actually look for ROOT_DIR

* format (sigh)

* add mobot config

* dockerize and upload to fly

* remove pipfile

* update to new version of phonenumbers

Co-authored-by: technillogue <technillogue@gmail.com>
…roups she's added to. (#213)

* Initial commit

* this should be done

* do gg

* bepdicted the whitelist added methods

* black

* fix type errors

* fix lints from new pylint version

* missed await in hotline

Co-authored-by: transfaeries <transfaeries@gmail.com>
Co-authored-by: technillogue <technillogue@gmail.com>
@jgreat jgreat force-pushed the main branch 3 times, most recently from cd0757b to 395d3b9 Compare April 10, 2023 22:17
@jgreat jgreat closed this Apr 11, 2023
@jgreat jgreat deleted the imogen-postgres branch April 11, 2023 15:53
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.

None yet