mirror of
https://github.com/open-webui/open-webui
synced 2025-06-23 02:16:52 +00:00
chore: format
This commit is contained in:
parent
ee8de1ee0b
commit
63fe426a52
@ -959,7 +959,9 @@ DEFAULT_MODELS = PersistentConfig(
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
default_prompt_suggestions = json.loads(os.environ.get("DEFAULT_PROMPT_SUGGESTIONS", "[]"))
|
default_prompt_suggestions = json.loads(
|
||||||
|
os.environ.get("DEFAULT_PROMPT_SUGGESTIONS", "[]")
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(f"Error loading DEFAULT_PROMPT_SUGGESTIONS: {e}")
|
log.exception(f"Error loading DEFAULT_PROMPT_SUGGESTIONS: {e}")
|
||||||
default_prompt_suggestions = []
|
default_prompt_suggestions = []
|
||||||
@ -1255,7 +1257,9 @@ def validate_cors_origin(origin):
|
|||||||
# To test CORS_ALLOW_ORIGIN locally, you can set something like
|
# To test CORS_ALLOW_ORIGIN locally, you can set something like
|
||||||
# CORS_ALLOW_ORIGIN=http://localhost:5173;http://localhost:8080
|
# CORS_ALLOW_ORIGIN=http://localhost:5173;http://localhost:8080
|
||||||
# in your .env file depending on your frontend port, 5173 in this case.
|
# in your .env file depending on your frontend port, 5173 in this case.
|
||||||
CORS_ALLOW_ORIGIN = os.environ.get("CORS_ALLOW_ORIGIN", "*;http://localhost:5173;http://localhost:8080").split(";")
|
CORS_ALLOW_ORIGIN = os.environ.get(
|
||||||
|
"CORS_ALLOW_ORIGIN", "*;http://localhost:5173;http://localhost:8080"
|
||||||
|
).split(";")
|
||||||
|
|
||||||
if "*" in CORS_ALLOW_ORIGIN:
|
if "*" in CORS_ALLOW_ORIGIN:
|
||||||
log.warning(
|
log.warning(
|
||||||
|
@ -44,7 +44,9 @@ class StorageProvider(ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def upload_file(self, file: BinaryIO, filename: str, tags: Dict[str, str]) -> Tuple[bytes, str]:
|
def upload_file(
|
||||||
|
self, file: BinaryIO, filename: str, tags: Dict[str, str]
|
||||||
|
) -> Tuple[bytes, str]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
@ -58,7 +60,9 @@ class StorageProvider(ABC):
|
|||||||
|
|
||||||
class LocalStorageProvider(StorageProvider):
|
class LocalStorageProvider(StorageProvider):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def upload_file(file: BinaryIO, filename: str, tags: Dict[str, str]) -> Tuple[bytes, str]:
|
def upload_file(
|
||||||
|
file: BinaryIO, filename: str, tags: Dict[str, str]
|
||||||
|
) -> Tuple[bytes, str]:
|
||||||
contents = file.read()
|
contents = file.read()
|
||||||
if not contents:
|
if not contents:
|
||||||
raise ValueError(ERROR_MESSAGES.EMPTY_CONTENT)
|
raise ValueError(ERROR_MESSAGES.EMPTY_CONTENT)
|
||||||
@ -131,10 +135,12 @@ class S3StorageProvider(StorageProvider):
|
|||||||
self.bucket_name = S3_BUCKET_NAME
|
self.bucket_name = S3_BUCKET_NAME
|
||||||
self.key_prefix = S3_KEY_PREFIX if S3_KEY_PREFIX else ""
|
self.key_prefix = S3_KEY_PREFIX if S3_KEY_PREFIX else ""
|
||||||
|
|
||||||
def upload_file(self, file: BinaryIO, filename: str, tags: Dict[str, str]) -> Tuple[bytes, str]:
|
def upload_file(
|
||||||
|
self, file: BinaryIO, filename: str, tags: Dict[str, str]
|
||||||
|
) -> Tuple[bytes, str]:
|
||||||
"""Handles uploading of the file to S3 storage."""
|
"""Handles uploading of the file to S3 storage."""
|
||||||
_, file_path = LocalStorageProvider.upload_file(file, filename, tags)
|
_, file_path = LocalStorageProvider.upload_file(file, filename, tags)
|
||||||
tagging = {'TagSet': [{'Key': k, 'Value': v} for k, v in tags.items()]}
|
tagging = {"TagSet": [{"Key": k, "Value": v} for k, v in tags.items()]}
|
||||||
try:
|
try:
|
||||||
s3_key = os.path.join(self.key_prefix, filename)
|
s3_key = os.path.join(self.key_prefix, filename)
|
||||||
self.s3_client.upload_file(file_path, self.bucket_name, s3_key)
|
self.s3_client.upload_file(file_path, self.bucket_name, s3_key)
|
||||||
@ -213,7 +219,9 @@ class GCSStorageProvider(StorageProvider):
|
|||||||
self.gcs_client = storage.Client()
|
self.gcs_client = storage.Client()
|
||||||
self.bucket = self.gcs_client.bucket(GCS_BUCKET_NAME)
|
self.bucket = self.gcs_client.bucket(GCS_BUCKET_NAME)
|
||||||
|
|
||||||
def upload_file(self, file: BinaryIO, filename: str, tags: Dict[str, str]) -> Tuple[bytes, str]:
|
def upload_file(
|
||||||
|
self, file: BinaryIO, filename: str, tags: Dict[str, str]
|
||||||
|
) -> Tuple[bytes, str]:
|
||||||
"""Handles uploading of the file to GCS storage."""
|
"""Handles uploading of the file to GCS storage."""
|
||||||
contents, file_path = LocalStorageProvider.upload_file(file, filename, tags)
|
contents, file_path = LocalStorageProvider.upload_file(file, filename, tags)
|
||||||
try:
|
try:
|
||||||
@ -283,7 +291,9 @@ class AzureStorageProvider(StorageProvider):
|
|||||||
self.container_name
|
self.container_name
|
||||||
)
|
)
|
||||||
|
|
||||||
def upload_file(self, file: BinaryIO, filename: str, tags: Dict[str, str]) -> Tuple[bytes, str]:
|
def upload_file(
|
||||||
|
self, file: BinaryIO, filename: str, tags: Dict[str, str]
|
||||||
|
) -> Tuple[bytes, str]:
|
||||||
"""Handles uploading of the file to Azure Blob Storage."""
|
"""Handles uploading of the file to Azure Blob Storage."""
|
||||||
contents, file_path = LocalStorageProvider.upload_file(file, filename, tags)
|
contents, file_path = LocalStorageProvider.upload_file(file, filename, tags)
|
||||||
try:
|
try:
|
||||||
|
@ -62,6 +62,8 @@
|
|||||||
"Allow Chat Delete": "Tillad sletning af chats",
|
"Allow Chat Delete": "Tillad sletning af chats",
|
||||||
"Allow Chat Deletion": "Tillad sletning af chats",
|
"Allow Chat Deletion": "Tillad sletning af chats",
|
||||||
"Allow Chat Edit": "Tillad redigering af chats",
|
"Allow Chat Edit": "Tillad redigering af chats",
|
||||||
|
"Allow Chat Export": "",
|
||||||
|
"Allow Chat Share": "",
|
||||||
"Allow File Upload": "Tillad upload af fil",
|
"Allow File Upload": "Tillad upload af fil",
|
||||||
"Allow Multiple Models in Chat": "Tillad flere modeller i chats",
|
"Allow Multiple Models in Chat": "Tillad flere modeller i chats",
|
||||||
"Allow non-local voices": "Tillad ikke-lokale stemmer",
|
"Allow non-local voices": "Tillad ikke-lokale stemmer",
|
||||||
@ -76,6 +78,7 @@
|
|||||||
"Always": "Altid",
|
"Always": "Altid",
|
||||||
"Always Collapse Code Blocks": "Altid kollapsere kodeblokke",
|
"Always Collapse Code Blocks": "Altid kollapsere kodeblokke",
|
||||||
"Always Expand Details": "Altid udvide detaljer",
|
"Always Expand Details": "Altid udvide detaljer",
|
||||||
|
"Always Play Notification Sound": "",
|
||||||
"Amazing": "Fantastisk",
|
"Amazing": "Fantastisk",
|
||||||
"an assistant": "en assistent",
|
"an assistant": "en assistent",
|
||||||
"Analyzed": "Analyseret",
|
"Analyzed": "Analyseret",
|
||||||
|
@ -417,7 +417,7 @@
|
|||||||
"Enter Document Intelligence Key": "",
|
"Enter Document Intelligence Key": "",
|
||||||
"Enter domains separated by commas (e.g., example.com,site.org)": "Geben Sie die Domains durch Kommas separiert ein (z.B. example.com,site.org)",
|
"Enter domains separated by commas (e.g., example.com,site.org)": "Geben Sie die Domains durch Kommas separiert ein (z.B. example.com,site.org)",
|
||||||
"Enter Exa API Key": "Geben Sie den Exa-API-Schlüssel ein",
|
"Enter Exa API Key": "Geben Sie den Exa-API-Schlüssel ein",
|
||||||
"Enter External Web Loader API Key": "",
|
"Enter External Web Loader API Key": "",
|
||||||
"Enter External Web Loader URL": "",
|
"Enter External Web Loader URL": "",
|
||||||
"Enter External Web Search API Key": "",
|
"Enter External Web Search API Key": "",
|
||||||
"Enter External Web Search URL": "",
|
"Enter External Web Search URL": "",
|
||||||
|
Loading…
Reference in New Issue
Block a user