Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the audio tool #10695

Merged
merged 2 commits into from
Nov 14, 2024
Merged

feat: add the audio tool #10695

merged 2 commits into from
Nov 14, 2024

Conversation

hjlarry
Copy link
Contributor

@hjlarry hjlarry commented Nov 14, 2024

Summary

Tip

Close issue syntax: Fixes #<issue number> or Resolves #<issue number>, see documentation for more details.

Currently, the tts and speech2text only available in a chat. I think make it as a tool can help people do something like generate audio story/podcast...

Close #10694

Screenshots

image

image

Checklist:

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🔨 feat:tools Tools for agent, function call related stuff. labels Nov 14, 2024
@hjlarry
Copy link
Contributor Author

hjlarry commented Nov 14, 2024

some people use http node to do this #10694

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 14, 2024
@crazywoola crazywoola merged commit 15f341b into langgenius:main Nov 14, 2024
6 checks passed
AlwaysBluer pushed a commit to AlwaysBluer/dify that referenced this pull request Nov 14, 2024
@fdb02983rhy
Copy link
Contributor

Please notice it will raise IndexError when user's available TTS or ASR model are empty.

api-1         | Traceback (most recent call last):
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
api-1         |     rv = self.dispatch_request()
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
api-1         |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
api-1         |     resp = resource(*args, **kwargs)
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
api-1         |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
api-1         |     resp = meth(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/wraps.py", line 142, in decorated
api-1         |     return view(*args, **kwargs)
api-1         |   File "/app/api/libs/login.py", line 92, in decorated_view
api-1         |     return current_app.ensure_sync(func)(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/wraps.py", line 26, in decorated
api-1         |     return view(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/workspace/tool_providers.py", line 502, in get
api-1         |     for provider in BuiltinToolManageService.list_builtin_tools(
api-1         |   File "/app/api/services/tools/builtin_tools_manage_service.py", line 245, in list_builtin_tools
api-1         |     raise e
api-1         |   File "/app/api/services/tools/builtin_tools_manage_service.py", line 235, in list_builtin_tools
api-1         |     ToolTransformService.tool_to_user_tool(
api-1         |   File "/app/api/services/tools/tools_transform_service.py", line 245, in tool_to_user_tool
api-1         |     runtime_parameters = tool.get_runtime_parameters() or []
api-1         |   File "/app/api/core/tools/provider/builtin/audio/tools/tts.py", line 86, in get_runtime_parameters
api-1         |     default=options[0].value,
api-1         | IndexError: list index out of range

@hjlarry @crazywoola

@hjlarry
Copy link
Contributor Author

hjlarry commented Nov 15, 2024

Please notice it will raise IndexError when user's available TTS or ASR model are empty.

thanks, I will fix this later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 feat:tools Tools for agent, function call related stuff. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP Post form-data does not work with file (Could not parse multipart form)
3 participants