Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d274f6bda | |||
| 4d36701f75 | |||
| c70090198f | |||
| ade85ab469 |
@@ -169,3 +169,4 @@ cython_debug/
|
||||
|
||||
# Vscode
|
||||
.vscode/
|
||||
.env
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
- **Author:** [quicksandzn](https://github.com/quicksandznzn)
|
||||
- **Github:** https://github.com/quicksandznzn/dify-plugin-minimax-kit
|
||||
- **Version:** 0.0.1
|
||||
- **Version:** 0.0.2
|
||||
- **Type:** tool
|
||||
|
||||
### Description
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
version: 0.0.1
|
||||
version: 0.0.2
|
||||
type: plugin
|
||||
author: quicksandzn
|
||||
name: minimax_kit
|
||||
@@ -6,8 +6,8 @@ label:
|
||||
en_US: MiniMax Kit
|
||||
zh_Hans: MiniMax 工具箱
|
||||
description:
|
||||
en_US: MiniMax Kit
|
||||
zh_Hans: MiniMax 工具箱
|
||||
en_US: A comprehensive toolkit integrating MiniMax's AI capabilities, including image generation, music generation, voice cloning, and video generation. Easily create and manage multimedia content with state-of-the-art generative models.
|
||||
zh_Hans: 集成 MiniMax 多种 AI 能力的工具箱,支持图片生成、音乐生成、声音克隆和视频生成。助您便捷高效地创作和管理多媒体内容,体验先进的生成式模型。
|
||||
icon: icon.svg
|
||||
resource:
|
||||
memory: 268435456
|
||||
|
||||
@@ -40,6 +40,7 @@ tools:
|
||||
- tools/music_generation.yaml
|
||||
- tools/voice_clone.yaml
|
||||
- tools/video_generation.yaml
|
||||
- tools/list_voicers.yaml
|
||||
extra:
|
||||
python:
|
||||
source: provider/minimax.py
|
||||
@@ -163,3 +163,10 @@ class MiniMaxBaseTool:
|
||||
params={"GroupId": self.group_id, "purpose": purpose},
|
||||
)
|
||||
return response
|
||||
def get_voice(self, voice_type: str) -> requests.Response:
|
||||
response = self._request(
|
||||
"POST",
|
||||
f"{API_ENDPOINT}/get_voice",
|
||||
data={"voice_type": voice_type},
|
||||
)
|
||||
return response
|
||||
@@ -0,0 +1,57 @@
|
||||
import json
|
||||
from typing import Generator, Any
|
||||
from dify_plugin import Tool
|
||||
from dify_plugin.entities.tool import ToolInvokeMessage
|
||||
import datetime
|
||||
|
||||
from tools.base import MiniMaxBaseTool
|
||||
|
||||
|
||||
class ListVoicers(Tool):
|
||||
def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage, None, None]:
|
||||
"""
|
||||
List available models from Fish Audio
|
||||
"""
|
||||
api_key = self.runtime.credentials.get("api_key")
|
||||
group_id = self.runtime.credentials.get("group_id")
|
||||
minimax = MiniMaxBaseTool(api_key=api_key, group_id=group_id)
|
||||
voice_type = tool_parameters.get("voice_type")
|
||||
response = minimax.get_voice(
|
||||
voice_type=voice_type
|
||||
)
|
||||
if response.status_code != 200:
|
||||
yield self.create_text_message(
|
||||
f"Get voice failed {response.status_code} {response.text}"
|
||||
)
|
||||
return
|
||||
status_code = response.json().get("base_resp", {}).get("status_code", -1)
|
||||
if status_code != 0:
|
||||
yield self.create_text_message(f"Get voice failed {response.text}")
|
||||
return
|
||||
lines = []
|
||||
i = 1
|
||||
|
||||
# 遍历三个类别
|
||||
for category in ["system_voice", "voice_cloning", "voice_generation"]:
|
||||
items = response.json().get(category, [])
|
||||
if not isinstance(items, list):
|
||||
continue
|
||||
lines.append(f"=== Category: {category} ===")
|
||||
for item in items:
|
||||
voice_id = item.get("voice_id", "")
|
||||
voice_name = item.get("voice_name", "无")
|
||||
desc_list = item.get("description", [])
|
||||
desc = ";".join(desc_list) if desc_list else "无"
|
||||
created_time = item.get("created_time", "")
|
||||
|
||||
lines.append(
|
||||
f"{i}.ID: {voice_id}\n"
|
||||
f" Voice Name: {voice_name}\n"
|
||||
f" Description: {desc}\n"
|
||||
f" Created_time: {created_time}\n"
|
||||
)
|
||||
i += 1
|
||||
|
||||
yield self.create_text_message("\n\n".join(lines))
|
||||
yield self.create_json_message(response.json())
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
identity:
|
||||
name: list_voicers
|
||||
author: langgenius
|
||||
label:
|
||||
en_US: List all voicers
|
||||
zh_Hans: 列出发音人
|
||||
description:
|
||||
human:
|
||||
en_US: List all voicers
|
||||
zh_Hans: 列出发音人
|
||||
llm: A tool to list all voicers
|
||||
|
||||
parameters:
|
||||
- name: voice_type
|
||||
type: select
|
||||
required: true
|
||||
default: all
|
||||
options:
|
||||
- value: all
|
||||
label:
|
||||
en_US: All
|
||||
zh_Hans: 所有
|
||||
- value: system
|
||||
label:
|
||||
en_US: System
|
||||
zh_Hans: 系统音色
|
||||
- value: voice_cloning
|
||||
label:
|
||||
en_US: Voice cloning voicers
|
||||
zh_Hans: 快速复刻的音色
|
||||
- value: voice_generation
|
||||
label:
|
||||
en_US: Text generation voicers
|
||||
zh_Hans: 文生音色接口生成的音色
|
||||
label:
|
||||
en_US: Voicer type
|
||||
zh_Hans: 音色类型
|
||||
human_description:
|
||||
en_US: Voicer type
|
||||
zh_Hans: 音色类型
|
||||
llm_description: Voicer type to list.
|
||||
form: form
|
||||
|
||||
extra:
|
||||
python:
|
||||
source: tools/list_voicers.py
|
||||
Reference in New Issue
Block a user