Skip to content

Commit

Permalink
feat:suno 作曲
Browse files Browse the repository at this point in the history
  • Loading branch information
fanxuankai committed Jun 3, 2024
1 parent 6f77d22 commit 6341b5c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions plugins/suno/suno.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
desire_priority=-1,
hidden=True,
desc="suno api plugin",
version="0.1",
version="1.0",
author="Jolc",
)
class Suno(Plugin):
Expand All @@ -21,10 +21,8 @@ def __init__(self):
super().__init__()
try:
self.config = super().load_config()
self.server = self.config.get("server")
self.server = self.config.get("mv")
self.prompt = self.config.get("prompt")
self.make_instrumental = self.config.get("make_instrumental")
if not self.config:
self._load_config_template()
logger.info("[Suno] inited")
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
except Exception as e:
Expand Down Expand Up @@ -78,3 +76,14 @@ def request_suno(self, content):
def get_help_text(self, **kwargs):
plugin_prefix = self.config.get("prefix")
return f"输入:{plugin_prefix} 赫本的风,我会为您作曲"

def _load_config_template(self):
logger.debug("No Suno plugin config.json, use plugins/suno/config.json.template")
try:
plugin_config_path = os.path.join(self.path, "config.json.template")
if os.path.exists(plugin_config_path):
with open(plugin_config_path, "r", encoding="utf-8") as f:
plugin_conf = json.load(f)
return plugin_conf
except Exception as e:
logger.exception(e)

0 comments on commit 6341b5c

Please sign in to comment.