diff --git a/packages/dvilela/agents/tsunami/aea-config.yaml b/packages/dvilela/agents/tsunami/aea-config.yaml index dbe6461..4b38529 100644 --- a/packages/dvilela/agents/tsunami/aea-config.yaml +++ b/packages/dvilela/agents/tsunami/aea-config.yaml @@ -44,8 +44,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq - valory/registration_abci:0.1.0:bafybeiek7zcsxbucjwzgqfftafhfrocvc7q4yxllh2q44jeemsjxg3rcfm - valory/reset_pause_abci:0.1.0:bafybeidw4mbx3os3hmv7ley7b3g3gja7ydpitr7mxbjpwzxin2mzyt5yam -- dvilela/tsunami_abci:0.1.0:bafybeig3mg2bwkxbsi5fwryzw533bzwj2pzwj7i6nywuahrfsauqw2dprm -- dvilela/tsunami_chained_abci:0.1.0:bafybeifabksyadyfdfe2mcqqxuisowacmvedynj5unfd5gfuvslg4e5sq4 +- dvilela/tsunami_abci:0.1.0:bafybeihw7ecxhxxxhv5xru33lehu7jw2qcpf4l5ntspiby5sger5fwjdwm +- dvilela/tsunami_chained_abci:0.1.0:bafybeigvezvvzhnx3hbgz3zte2tsrtx7uczgems5uzrhx27dqdxndzz5wm default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/dvilela/services/tsunami/service.yaml b/packages/dvilela/services/tsunami/service.yaml index 18ef1c2..b0bc3cd 100644 --- a/packages/dvilela/services/tsunami/service.yaml +++ b/packages/dvilela/services/tsunami/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibh5bgshii5oqjfuhwmiivfvfqy7fw5pzvarxkpe4qrgivxtc3xym fingerprint_ignore_patterns: [] -agent: dvilela/tsunami:0.1.0:bafybeiabblusrfbkeie5gnxhfgxlntz3h2scbbqgqu2mekdrnugg5t6fqy +agent: dvilela/tsunami:0.1.0:bafybeihktqlhcqx6hfx3m2mgxbpfovnqap2norpa574r3ssshmf2hgnzym number_of_agents: 1 deployment: agent: diff --git a/packages/dvilela/skills/tsunami_abci/behaviours.py b/packages/dvilela/skills/tsunami_abci/behaviours.py index cc612e5..30d0ec6 100644 --- a/packages/dvilela/skills/tsunami_abci/behaviours.py +++ b/packages/dvilela/skills/tsunami_abci/behaviours.py @@ -1193,6 +1193,23 @@ def get_suno_tweets( # pylint: disable=too-many-locals,too-many-return-statemen n_agents = len(agents) self.context.logger.info(f"Got {n_agents} agents") + # Filter out agents from past songs + response = yield from self._read_kv(keys=("previous_suno_agents",)) + + if response is None: + self.context.logger.error( + "Error reading previous_suno_agents from the database." + ) + return tweets + + previous_suno_agents = response["previous_suno_agents"] + self.context.logger.info( + f"Loaded previous_suno_agents from db: {previous_suno_agents}" + ) + + previous_suno_agents = json.loads(previous_suno_agents or "[]") + agents = [a for a in agents if int(a["tokenId"]) not in previous_suno_agents] + # Select a random agent and genre agent = secrets.choice(agents) # nosec agent_name = agent["publicId"].split("/")[-1] @@ -1204,6 +1221,7 @@ def get_suno_tweets( # pylint: disable=too-many-locals,too-many-return-statemen agent_description=agent_description, ) self.context.logger.info("Suno prompt is: {prompt}") + previous_suno_agents.append(int(agent["tokenId"])) # Call Suno conection suno_response = yield from self._call_suno(prompt=prompt) @@ -1246,6 +1264,11 @@ def get_suno_tweets( # pylint: disable=too-many-locals,too-many-return-statemen # Save run time to the db yield from self._write_kv({"suno_last_run_date": today.strftime("%Y-%m-%d")}) + # Save agents to the db + yield from self._write_kv( + {"previous_suno_agents": json.dumps(previous_suno_agents, sort_keys=True)} + ) + return tweets diff --git a/packages/dvilela/skills/tsunami_abci/skill.yaml b/packages/dvilela/skills/tsunami_abci/skill.yaml index ca147d8..b908c91 100644 --- a/packages/dvilela/skills/tsunami_abci/skill.yaml +++ b/packages/dvilela/skills/tsunami_abci/skill.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeiaicsttkv5xapta2eqove7si2pyv3zmshkqolluxpnrh3hkulqsqu - behaviours.py: bafybeifaqd6qukdqppqf7kzkqmufmrz2uqyox7joap6og2k7hbvrqhrwmi + behaviours.py: bafybeigmridv5zedpqqmksziomt4vkg7ryi5rv4axugqizoaptsgr3ewwe dialogues.py: bafybeidmgjji6zw6wcvhijrxb74batj2kc2lskfuqxv76duv2j7azcqwra fsm_specification.yaml: bafybeibrbzzs726xnbay6yyknx7nkcyrvprrvb5sojlyxy4ndoksugcfq4 handlers.py: bafybeialhc4f2333c6lvyt3yhrwju6h46ph2fc4qysydhcf5fe45zw43ly diff --git a/packages/dvilela/skills/tsunami_chained_abci/skill.yaml b/packages/dvilela/skills/tsunami_chained_abci/skill.yaml index f160e53..b676eb8 100644 --- a/packages/dvilela/skills/tsunami_chained_abci/skill.yaml +++ b/packages/dvilela/skills/tsunami_chained_abci/skill.yaml @@ -23,7 +23,7 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeidw4mbx3os3hmv7ley7b3g3gja7ydpitr7mxbjpwzxin2mzyt5yam - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq - valory/termination_abci:0.1.0:bafybeihq6qtbwt6i53ayqym63vhjexkcppy26gguzhhjqywfmiuqghvv44 -- dvilela/tsunami_abci:0.1.0:bafybeig3mg2bwkxbsi5fwryzw533bzwj2pzwj7i6nywuahrfsauqw2dprm +- dvilela/tsunami_abci:0.1.0:bafybeihw7ecxhxxxhv5xru33lehu7jw2qcpf4l5ntspiby5sger5fwjdwm behaviours: main: args: {} diff --git a/packages/packages.json b/packages/packages.json index 0fe1cc4..a71ee32 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -6,10 +6,10 @@ "connection/dvilela/llama/0.1.0": "bafybeientp27ic3s2wbmrxxsmxg3wvshcoecjl3nvo75lb5faw3rersu7u", "connection/valory/twitter/0.1.0": "bafybeihotqawulig3g4a7fosi4pljsjii2neiqxtepd42e2neemhqecfcq", "connection/dvilela/suno/0.1.0": "bafybeialefoyek6fxtlowsj34rmycdqvs7y5e73fmojy5te7yibu6mheia", - "skill/dvilela/tsunami_abci/0.1.0": "bafybeig3mg2bwkxbsi5fwryzw533bzwj2pzwj7i6nywuahrfsauqw2dprm", - "skill/dvilela/tsunami_chained_abci/0.1.0": "bafybeifabksyadyfdfe2mcqqxuisowacmvedynj5unfd5gfuvslg4e5sq4", - "agent/dvilela/tsunami/0.1.0": "bafybeiabblusrfbkeie5gnxhfgxlntz3h2scbbqgqu2mekdrnugg5t6fqy", - "service/dvilela/tsunami/0.1.0": "bafybeiau2smuqemiptf5cnw2zipvx34fxv2cg7wf4km2cd5j5tuu3xskdu" + "skill/dvilela/tsunami_abci/0.1.0": "bafybeihw7ecxhxxxhv5xru33lehu7jw2qcpf4l5ntspiby5sger5fwjdwm", + "skill/dvilela/tsunami_chained_abci/0.1.0": "bafybeigvezvvzhnx3hbgz3zte2tsrtx7uczgems5uzrhx27dqdxndzz5wm", + "agent/dvilela/tsunami/0.1.0": "bafybeihktqlhcqx6hfx3m2mgxbpfovnqap2norpa574r3ssshmf2hgnzym", + "service/dvilela/tsunami/0.1.0": "bafybeie3algsst3s3lbsi6gnrvcihl55likwjivk7qzfgch5fmts5rujee" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",