mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
refactor(tools): Avoid warnings. (#10161)
This commit is contained in:
parent
bf048b8d7c
commit
3c85136279
|
@ -1,5 +1,5 @@
|
|||
import matplotlib.pyplot as plt
|
||||
from matplotlib.font_manager import FontProperties
|
||||
from matplotlib.font_manager import FontProperties, fontManager
|
||||
|
||||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
|
||||
|
@ -17,9 +17,10 @@ def set_chinese_font():
|
|||
]
|
||||
|
||||
for font in font_list:
|
||||
chinese_font = FontProperties(font)
|
||||
if chinese_font.get_name() == font:
|
||||
return chinese_font
|
||||
if font in fontManager.ttflist:
|
||||
chinese_font = FontProperties(font)
|
||||
if chinese_font.get_name() == font:
|
||||
return chinese_font
|
||||
|
||||
return FontProperties()
|
||||
|
||||
|
|
|
@ -2,14 +2,17 @@ import concurrent.futures
|
|||
import io
|
||||
import random
|
||||
from typing import Any, Literal, Optional, Union
|
||||
from warnings import catch_warnings
|
||||
|
||||
import openai
|
||||
from pydub import AudioSegment
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.errors import ToolParameterValidationError, ToolProviderCredentialValidationError
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
with catch_warnings(action="ignore", category=RuntimeWarning):
|
||||
from pydub import AudioSegment
|
||||
|
||||
|
||||
class PodcastAudioGeneratorTool(BuiltinTool):
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue
Block a user