Skip to content

Commit

Permalink
Merge pull request #68 from dvilelaf/fix_/feedback
Browse files Browse the repository at this point in the history
Fix /feedback
  • Loading branch information
dvilelaf authored Dec 5, 2024
2 parents 0dbef20 + 4560cc5 commit 0b17d18
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/dvilela/agents/memeooorr/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeihq2yenstblmaadzcjousowj5kfn5l7ns5pxweq2gcrsczfyq5wzm
- valory/registration_abci:0.1.0:bafybeicnth5q4httefsusywx3zrrq4al47owvge72dqf2fziruicq6hqta
- valory/reset_pause_abci:0.1.0:bafybeievjciqdvxhqxfjd4whqs27h6qbxqzrae7wwj7fpvxlvmtw3x35im
- dvilela/memeooorr_abci:0.1.0:bafybeigrve6npjfbqprz6psadsfjcgijs7qbdjm7pcv7aewrqojljhqyga
- dvilela/memeooorr_chained_abci:0.1.0:bafybeigv5hhl2fu3aqs7cg7svnhljhmmiu6zanrf4g6yi5vhqpqmm6dh5q
- dvilela/memeooorr_abci:0.1.0:bafybeigvpwpqmx5jek4mkv52tq622f6whb6lnjjefltgqavdo2xbfb3ota
- dvilela/memeooorr_chained_abci:0.1.0:bafybeibj6z7i34tkop5nrb36pqgxd3ugaueursd36nemodttntbypgn6si
default_ledger: ethereum
required_ledgers:
- ethereum
Expand Down
2 changes: 1 addition & 1 deletion packages/dvilela/services/memeooorr/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeiaekcmielp6mb4qvmo2twwkpmoun36bqajrh7wnnkcpdnia45ycl4
fingerprint_ignore_patterns: []
agent: dvilela/memeooorr:0.1.0:bafybeicppw5vdsjephd55zfmqyvxjqejrgugclshresnvkz3dfhabmwmcq
agent: dvilela/memeooorr:0.1.0:bafybeic6v7fwo7gizkeko6livhlq74x2xl5khdwdn5qpt7hcnteemw7pou
number_of_agents: 1
deployment:
agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ def get_extra_meme_info(self, meme_coins: List) -> Generator[None, None, List]:
enriched_meme_coins = []

for meme_coin in meme_coins:
self.context.logger.info(
f"Gathering extra info for token {meme_coin['token_address']}"
)
response_msg = yield from self.get_contract_api_response(
performative=ContractApiMessage.Performative.GET_STATE, # type: ignore
contract_address=meme_coin["token_address"],
Expand Down Expand Up @@ -411,7 +414,6 @@ def get_chain_id(self) -> str:
chain_id = (
BASE_CHAIN_ID if self.params.home_chain_id == "BASE" else CELO_CHAIN_ID
)
print(f"CHAIN_ID={chain_id}")
return chain_id

def get_packages(self, package_type: str) -> Generator[None, None, Optional[Dict]]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ def async_act(self) -> Generator:

self.set_done()

def get_analysis( # pylint: disable=too-many-locals
def get_analysis( # pylint: disable=too-many-locals,too-many-return-statements
self,
) -> Generator[None, None, Optional[Dict]]:
"""Post a tweet"""

if self.synchronized_data.feedback is None:
return None

tweet_responses = "\n\n".join(
[
f"tweet: {t['text']}\nviews: {t['view_count']}\nquotes: {t['quote_count']}\nretweets{t['retweet_count']}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def decide_post_tweet( # pylint: disable=too-many-locals
return {"wait": True}

# Enough time has passed, collect feedback
if not self.synchronized_data.feedback:
if self.synchronized_data.feedback is None:
self.context.logger.info(
"Feedback period has finished. Collecting feedback..."
)
Expand Down
11 changes: 7 additions & 4 deletions packages/dvilela/skills/memeooorr_abci/rounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ def token_data(self) -> Dict:
return cast(dict, json.loads(cast(str, self.db.get_strict("token_data"))))

@property
def feedback(self) -> List:
def feedback(self) -> Optional[List]:
"""Get the feedback."""
return cast(list, json.loads(cast(str, self.db.get("feedback", "[]"))))
feedback = self.db.get("feedback", None)
return json.loads(feedback) if feedback else None

@property
def most_voted_tx_hash(self) -> Optional[str]:
Expand Down Expand Up @@ -440,7 +441,7 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Event]]:
get_name(SynchronizedData.latest_tweet): "{}",
get_name(SynchronizedData.token_data): "{}",
get_name(SynchronizedData.persona): self.context.params.persona,
get_name(SynchronizedData.feedback): "[]",
get_name(SynchronizedData.feedback): None,
get_name(SynchronizedData.tx_flag): None,
get_name(SynchronizedData.most_voted_tx_hash): None,
},
Expand Down Expand Up @@ -723,7 +724,9 @@ class MemeooorrAbciApp(AbciApp[Event]):
}
final_states: Set[AppState] = {FinishedToResetRound, FinishedToSettlementRound}
event_to_timeout: EventToTimeout = {}
cross_period_persisted_keys: FrozenSet[str] = frozenset(["persona", "latest_tweet"])
cross_period_persisted_keys: FrozenSet[str] = frozenset(
["persona", "latest_tweet", "feedback"]
)
db_pre_conditions: Dict[AppState, Set[str]] = {
LoadDatabaseRound: set(),
PostTweetRound: set(),
Expand Down
8 changes: 4 additions & 4 deletions packages/dvilela/skills/memeooorr_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeidorrnxjv4n4ngovxnu4mzod46kyrdncfmli4hapqeqnzp7imq7hm
behaviour_classes/__init__.py: bafybeicjks4kxsb2r6a4armmaqxyxngwm3pouegq3fycm37rbe7otiwsre
behaviour_classes/base.py: bafybeib4f5aa3aoqoyag5pq6lmun7oejf4lhh5i4tly3ixxsj2sbovfnvy
behaviour_classes/base.py: bafybeihftyihou4pynvgxrxst5gw56xav26flh576oqoglid5oovnsaory
behaviour_classes/chain.py: bafybeidfs4c7ex26jp6u2s45ma6yz27cfhxqha3kjrzvar2dbk6fn7pk7q
behaviour_classes/db.py: bafybeieuhjes2gsiidepjxcojgnn3swx2znem5uwvz7rwkxpwls3dmlxf4
behaviour_classes/llm.py: bafybeifz6h7q6bl336zj2cqb5l4drujz75zrs5oowmpdaohloq2ip3ccaa
behaviour_classes/twitter.py: bafybeihnev3q6to2taafzuzntbe3bbmua5of6z5vmp5h5fzzsacaj3idpe
behaviour_classes/llm.py: bafybeifue224iv36mfjgl65z7ojgr6ixw3emkboafhbb4fafcontdi73ji
behaviour_classes/twitter.py: bafybeiftsmj2gfkodiep3mpazyw777od2svrg6iqu4chc6y5twnjnvwgru
behaviours.py: bafybeibdbimezloiomvsv3zgfdug4tw276gt7tb5agnezl2nuqcfcplscu
dialogues.py: bafybeiaygigeleloplgrsg2sovv463uvzk3zc2tupgazn4ak2vqcangksu
fsm_specification.yaml: bafybeidqesafw5vtekw2dtffjznuchdjllo52najwmmkj2npfdyaouigfa
handlers.py: bafybeigdxkm45w27sh7cpgiwuperjldql6oupbhxqtizhbwfv7abxe3dku
models.py: bafybeid7ngfjyc3ck65yuzriy7y7eppz5kn7m7nsrilcvtqhqsfu54cn5e
payloads.py: bafybeif5ycv3aaim4sbfkmx5jnwjm5yvx562zkykhng5on63zfeqskddse
prompts.py: bafybeicww22zga6ximcfjb3h4hwhqfupuapc3uxl3bmev4hjfgd7cymzea
rounds.py: bafybeickhz2scrsecxhooytqf2q32kp2sck6clv433bxqlcpfv3lrok2ia
rounds.py: bafybeiek6i7n5hdoaicaknpae6ohdxolmei4dtfykupw4sqf74zrm6l6uq
rounds_info.py: bafybeieqaemvqwiwku7nlxkdebsqzldpvvidijf6wcwy7e3xbyz335jr6i
subgraph.py: bafybeigme6r3cwiiu5l7r55rcbj7y37b62cxtlsnewpkbjqcbadwte32xm
fingerprint_ignore_patterns: []
Expand Down
2 changes: 1 addition & 1 deletion packages/dvilela/skills/memeooorr_chained_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeievjciqdvxhqxfjd4whqs27h6qbxqzrae7wwj7fpvxlvmtw3x35im
- valory/transaction_settlement_abci:0.1.0:bafybeihq2yenstblmaadzcjousowj5kfn5l7ns5pxweq2gcrsczfyq5wzm
- valory/termination_abci:0.1.0:bafybeid54buqxipiuduw7b6nnliiwsxajnltseuroad53wukfonpxca2om
- dvilela/memeooorr_abci:0.1.0:bafybeigrve6npjfbqprz6psadsfjcgijs7qbdjm7pcv7aewrqojljhqyga
- dvilela/memeooorr_abci:0.1.0:bafybeigvpwpqmx5jek4mkv52tq622f6whb6lnjjefltgqavdo2xbfb3ota
behaviours:
main:
args: {}
Expand Down
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"contract/dvilela/meme_factory/0.1.0": "bafybeihh2fty6e3w2bvhn6y6jwa3yyssnn6yttopmmjczpgsudwrd7q4hq",
"contract/dvilela/meme/0.1.0": "bafybeihubei6hbhbyiwwyxcbredb5mhomhwfktxlwufmqxrzo4jj4ohweq",
"connection/dvilela/twikit/0.1.0": "bafybeigk6gbijk6zbbtrnvou3twpxma743yzocuhfgdbde2fqzhieusyzq",
"skill/dvilela/memeooorr_abci/0.1.0": "bafybeigrve6npjfbqprz6psadsfjcgijs7qbdjm7pcv7aewrqojljhqyga",
"skill/dvilela/memeooorr_chained_abci/0.1.0": "bafybeigv5hhl2fu3aqs7cg7svnhljhmmiu6zanrf4g6yi5vhqpqmm6dh5q",
"agent/dvilela/memeooorr/0.1.0": "bafybeicppw5vdsjephd55zfmqyvxjqejrgugclshresnvkz3dfhabmwmcq",
"service/dvilela/memeooorr/0.1.0": "bafybeif4xqnxr5crsrxzo3kigdwizfxxwhigi2lu7btkfovkuwpwectdbm"
"skill/dvilela/memeooorr_abci/0.1.0": "bafybeigvpwpqmx5jek4mkv52tq622f6whb6lnjjefltgqavdo2xbfb3ota",
"skill/dvilela/memeooorr_chained_abci/0.1.0": "bafybeibj6z7i34tkop5nrb36pqgxd3ugaueursd36nemodttntbypgn6si",
"agent/dvilela/memeooorr/0.1.0": "bafybeic6v7fwo7gizkeko6livhlq74x2xl5khdwdn5qpt7hcnteemw7pou",
"service/dvilela/memeooorr/0.1.0": "bafybeiculhkyvpapcktmfqpo4pgzmw5t7qwn5ohd7rair2ryrsvmdw6pvi"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
2 changes: 1 addition & 1 deletion sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TWIKIT_USERNAME=
TWIKIT_EMAIL=
TWIKIT_PASSWORD=
TWIKIT_COOKIES='null'
FEEDBACK_PERIOD_HOURS=1
FEEDBACK_PERIOD_HOURS=3

# Gemini
# ---------------------------------------------------------------------------------------
Expand Down

0 comments on commit 0b17d18

Please sign in to comment.