Skip to content

Commit

Permalink
fix: tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
dvilelaf committed Mar 15, 2024
1 parent 3197f55 commit 8db48ec
Show file tree
Hide file tree
Showing 8 changed files with 4,626 additions and 5 deletions.
1,256 changes: 1,256 additions & 0 deletions packages/dvilela/contracts/agent_registry.json

Large diffs are not rendered by default.

1,217 changes: 1,217 additions & 0 deletions packages/dvilela/contracts/component_registry.json

Large diffs are not rendered by default.

2,031 changes: 2,031 additions & 0 deletions packages/dvilela/contracts/service_registry.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions packages/dvilela/skills/tsunami_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
TwitterDialogue,
TwitterDialogues,
)
from packages.dvilela.skills.tsunami_abci.prompts import SYSTEM_PROMPTS, USER_PROMPT_TEMPLATES


class TsunamiBaseBehaviour(BaseBehaviour, ABC):
Expand Down Expand Up @@ -108,11 +109,11 @@ def async_act(self) -> Generator:
# Publish tweets
for tweet in tweets:

if not tweet["twitter"]:
tweet["twitter"] = yield from self.publish_tweet(tweet["text"])
if self.params.publish_twitter and not tweet["twitter_published"]:
tweet["twitter_published"] = yield from self.publish_tweet(tweet["text"])["success"]

if not tweet["farcaster"]:
tweet["farcaster"] = yield from self.publish_cast(tweet["text"])
if self.params.publish_farcaster and not tweet["farcaster_published"]:
tweet["farcaster_published"] = yield from self.publish_cast(tweet["text"])["success"]

# Remove published tweets
tweets = [t for t in tweets if t["twitter"] and t["farcaster"]]
Expand Down
43 changes: 43 additions & 0 deletions packages/dvilela/skills/tsunami_abci/events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2024 David Vilela Freire
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""This module contains the tracked contract events."""
from enum import Enum


class Chain(Enum):
"""Chain"""
ETHEREUM = "ETHEREUM"
GNOSIS = "GNOSIS"


class ContractEvent(Enum):
"""ContractEvent"""


"service_registry": {
"CreateService",
"OperatorSlashed"
},
"agent_registry": {
"CreateUnit"
},
"component_registry": {
"CreateUnit"
}
13 changes: 12 additions & 1 deletion packages/dvilela/skills/tsunami_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

"""This module contains the shared state for the abci skill of TsunamiAbciApp."""

from typing import Any

from packages.dvilela.skills.tsunami_abci.rounds import TsunamiAbciApp
from packages.valory.skills.abstract_round_abci.models import BaseParams
from packages.valory.skills.abstract_round_abci.models import (
Expand All @@ -36,6 +38,15 @@ class SharedState(BaseSharedState):
abci_app_cls = TsunamiAbciApp


Params = BaseParams
Requests = BaseRequests
BenchmarkTool = BaseBenchmarkTool


class Params(BaseParams):
"""Parameters."""

def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Initialize the parameters object."""
self.publish_twitter = self._ensure("publish_twitter", kwargs, bool)
self.publish_farcaster = self._ensure("publish_farcaster", kwargs, bool)
super().__init__(*args, **kwargs)
60 changes: 60 additions & 0 deletions packages/dvilela/skills/tsunami_abci/prompts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2024 David Vilela Freire
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------
"""Prompts"""

SYSTEM_PROMPT_PIRATE = """
You are an old Twitter influencer who used to be a drunk pirate.
You announce new events in the blockchain space using your pirate language and words
related to the sea, fish and rum.
Users will send you some text about something that happened on the Olas ecosystem and your
task is to create a short Tweet to announce it.
Keep it short, under 250 characters.
"""

SYSTEM_PROMPT_OLAD = """
You are an Olad, a sophisticated, elegant, intellectual Twitter influencer from the 18th
century who uses a monocle, top hat and expensive silk three-piece suits.
You announce new events in the Olas blockchain ecosystem using well-mannered Victorian language,
sometimes referencing the way you dress and Olads, your colleagues.
Users will send you some text about something that happened on the Olas ecosystem and your
task is to create a short Tweet to announce it.
Keep it short, under 250 characters.
"""

SYSTEM_PROMPT_TECHIE = """
You are a sassy, grumpy techie Twitter influencer who writes about web3 protocols.
You announce new events in the blockchain space and you are really hyped up about it,
usually making sci-fi movie analogies like Star Trek, Dune or Star Wars.
Users will send you some text about something that happened on the Olas ecosystem and your
task is to create a short Tweet to announce it.
Keep it short, under 250 characters.
"""

USER_PROMPT_SERVICE = "A new service with id {service_id} has been minted on the Olas protocol"
USER_PROMPT_AGENT = "A new agent with id {agent_id} has been minted on the Olas protocol"
USER_PROMPT_COMPONENT = "A new component with id {component_id} has been minted on the Olas protocol"

SYSTEM_PROMPTS = [SYSTEM_PROMPT_PIRATE, SYSTEM_PROMPT_OLAD, SYSTEM_PROMPT_TECHIE]
USER_PROMPT_TEMPLATES = [USER_PROMPT_SERVICE, USER_PROMPT_AGENT, USER_PROMPT_COMPONENT]
2 changes: 2 additions & 0 deletions packages/dvilela/skills/tsunami_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ models:
tendermint_url: http://localhost:26657
tx_timeout: 10.0
validate_timeout: 1205
publish_twitter: true
publish_farcaster: true
class_name: Params
requests:
args: {}
Expand Down

0 comments on commit 8db48ec

Please sign in to comment.