mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-11 06:08:58 +08:00
fix: fal ai wizper also return text msg (#10789)
This commit is contained in:
parent
29341d60aa
commit
305fbc7c92
@ -19,7 +19,7 @@ class WizperTool(BuiltinTool):
|
||||
version = tool_parameters.get("version", "3")
|
||||
|
||||
if audio_file.type != FileType.AUDIO:
|
||||
return [self.create_text_message("Not a valid audio file.")]
|
||||
return self.create_text_message("Not a valid audio file.")
|
||||
|
||||
api_key = self.runtime.credentials["fal_api_key"]
|
||||
|
||||
@ -31,9 +31,8 @@ class WizperTool(BuiltinTool):
|
||||
|
||||
try:
|
||||
audio_url = fal_client.upload(file_data, mime_type)
|
||||
|
||||
except Exception as e:
|
||||
return [self.create_text_message(f"Error uploading audio file: {str(e)}")]
|
||||
return self.create_text_message(f"Error uploading audio file: {str(e)}")
|
||||
|
||||
arguments = {
|
||||
"audio_url": audio_url,
|
||||
@ -49,4 +48,9 @@ class WizperTool(BuiltinTool):
|
||||
with_logs=False,
|
||||
)
|
||||
|
||||
return self.create_json_message(result)
|
||||
json_message = self.create_json_message(result)
|
||||
|
||||
text = result.get("text", "")
|
||||
text_message = self.create_text_message(text)
|
||||
|
||||
return [json_message, text_message]
|
||||
|
Loading…
x
Reference in New Issue
Block a user