mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
Revert "fix the error of unable to retrieve url from file" (#10511)
This commit is contained in:
parent
b07ea5055b
commit
5656f81bde
|
@ -26,7 +26,7 @@ def get_attr(*, file: File, attr: FileAttribute):
|
||||||
case FileAttribute.TRANSFER_METHOD:
|
case FileAttribute.TRANSFER_METHOD:
|
||||||
return file.transfer_method.value
|
return file.transfer_method.value
|
||||||
case FileAttribute.URL:
|
case FileAttribute.URL:
|
||||||
return _to_url(file)
|
return file.remote_url
|
||||||
case FileAttribute.EXTENSION:
|
case FileAttribute.EXTENSION:
|
||||||
return file.extension
|
return file.extension
|
||||||
case _:
|
case _:
|
||||||
|
|
|
@ -32,18 +32,3 @@ credentials_for_provider:
|
||||||
placeholder:
|
placeholder:
|
||||||
en_US: Enter your TTS service API key
|
en_US: Enter your TTS service API key
|
||||||
zh_Hans: 输入您的 TTS 服务 API 密钥
|
zh_Hans: 输入您的 TTS 服务 API 密钥
|
||||||
openai_base_url:
|
|
||||||
type: text-input
|
|
||||||
required: false
|
|
||||||
label:
|
|
||||||
en_US: OpenAI base URL
|
|
||||||
zh_Hans: OpenAI base URL
|
|
||||||
pt_BR: OpenAI base URL
|
|
||||||
help:
|
|
||||||
en_US: Please input your OpenAI base URL
|
|
||||||
zh_Hans: 请输入你的 OpenAI base URL
|
|
||||||
pt_BR: Please input your OpenAI base URL
|
|
||||||
placeholder:
|
|
||||||
en_US: Please input your OpenAI base URL
|
|
||||||
zh_Hans: 请输入你的 OpenAI base URL
|
|
||||||
pt_BR: Please input your OpenAI base URL
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import warnings
|
||||||
from typing import Any, Literal, Optional, Union
|
from typing import Any, Literal, Optional, Union
|
||||||
|
|
||||||
import openai
|
import openai
|
||||||
from yarl import URL
|
|
||||||
|
|
||||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||||
from core.tools.errors import ToolParameterValidationError, ToolProviderCredentialValidationError
|
from core.tools.errors import ToolParameterValidationError, ToolProviderCredentialValidationError
|
||||||
|
@ -61,18 +60,8 @@ class PodcastAudioGeneratorTool(BuiltinTool):
|
||||||
if not api_key:
|
if not api_key:
|
||||||
raise ToolProviderCredentialValidationError("OpenAI API key is missing")
|
raise ToolProviderCredentialValidationError("OpenAI API key is missing")
|
||||||
|
|
||||||
# Get OpenAI base URL
|
|
||||||
openai_base_url = self.runtime.credentials.get("openai_base_url", None)
|
|
||||||
if not openai_base_url:
|
|
||||||
openai_base_url = None
|
|
||||||
else:
|
|
||||||
openai_base_url = str(URL(openai_base_url) / "v1")
|
|
||||||
|
|
||||||
# Initialize OpenAI client
|
# Initialize OpenAI client
|
||||||
client = openai.OpenAI(
|
client = openai.OpenAI(api_key=api_key)
|
||||||
api_key=api_key,
|
|
||||||
base_url=openai_base_url,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create a thread pool
|
# Create a thread pool
|
||||||
max_workers = 5
|
max_workers = 5
|
||||||
|
|
Loading…
Reference in New Issue
Block a user