Skip to content

Commit

Permalink
Revert "fix the error of unable to retrieve url from file (#10498)"
Browse files Browse the repository at this point in the history
This reverts commit 5eb27af.
  • Loading branch information
crazywoola authored Nov 11, 2024
1 parent b07ea50 commit ccc1e24
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion api/core/file/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_attr(*, file: File, attr: FileAttribute):
case FileAttribute.TRANSFER_METHOD:
return file.transfer_method.value
case FileAttribute.URL:
return _to_url(file)
return file.remote_url
case FileAttribute.EXTENSION:
return file.extension
case _:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,3 @@ credentials_for_provider:
placeholder:
en_US: Enter your TTS service API key
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Any, Literal, Optional, Union

import openai
from yarl import URL

from core.tools.entities.tool_entities import ToolInvokeMessage
from core.tools.errors import ToolParameterValidationError, ToolProviderCredentialValidationError
Expand Down Expand Up @@ -61,18 +60,8 @@ def _invoke(
if not api_key:
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
client = openai.OpenAI(
api_key=api_key,
base_url=openai_base_url,
)
client = openai.OpenAI(api_key=api_key)

# Create a thread pool
max_workers = 5
Expand Down

0 comments on commit ccc1e24

Please sign in to comment.