This commit is contained in:
2026-07-22 14:04:54 +08:00
parent d111977023
commit 6b78d5830d
8 changed files with 23 additions and 32 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# VITE_API_BASE=http://192.168.120.17:8000 # VITE_API_BASE=http://192.168.120.17:8000
#VITE_API_BASE=https://apiforeign.minzhong.cn #VITE_API_BASE=https://apiforeign.minzhong.cn
VITE_API_BASE=http://ceshi.apiforeign.minzhongzc.com VITE_API_BASE=https://ceshi.apiforeign.minzhongzc.com
VITE_USE_MOCK=false VITE_USE_MOCK=false
# Encryption disabled for dev — enable in production # Encryption disabled for dev — enable in production
VITE_ENCRYPTION_KEY= VITE_ENCRYPTION_KEY=
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
} }
})(); })();
</script> </script>
<script type="module" crossorigin src="/assets/index-DBKUBJv5.js"></script> <script type="module" crossorigin src="/assets/index-MWrMIMSc.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css"> <link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
</head> </head>
<body> <body>
+1 -1
View File
@@ -129,7 +129,7 @@ class Settings(BaseSettings):
CAPTCHA_ENABLED: bool = True CAPTCHA_ENABLED: bool = True
BASE_URL: str = "http://ceshi.apiforeign.minzhongzc.com" BASE_URL: str = "https://ceshi.apiforeign.minzhongzc.com"
CORS_ORIGINS: list[str] = ["*"] CORS_ORIGINS: list[str] = ["*"]
+5 -14
View File
@@ -1,6 +1,4 @@
import base64
import json import json
import mimetypes
import os import os
from datetime import datetime from datetime import datetime
@@ -292,22 +290,15 @@ async def _call_openai_compatible(
def _file_url_or_data_uri(file_url: str, fallback_mime: str) -> str: def _file_url_or_data_uri(file_url: str, fallback_mime: str) -> str:
""" """
Convert local upload path to base64 data URI. 远程 URL 保持原样;本地上传路径拼接 BASE_URL 转为完整链接。
Keep remote http/https/data URLs as-is.
""" """
if file_url.startswith(("http://", "https://", "data:")): if file_url.startswith(("http://", "https://", "data:")):
return file_url return file_url
# Compatible with /uploads/xxx and plain relative paths # 本地上传路径拼接 BASE_URL,例如 /uploads/images/xxx.png → https://domain.com/uploads/images/xxx.png
relative_path = file_url.replace("/uploads/", "", 1).lstrip("/") base = settings.BASE_URL.rstrip("/")
file_path = os.path.join(settings.UPLOAD_LOCAL_PATH, relative_path) path = file_url if file_url.startswith("/") else f"/{file_url}"
return f"{base}{path}"
mime = mimetypes.guess_type(file_path)[0] or fallback_mime
with open(file_path, "rb") as f:
b64 = base64.b64encode(f.read()).decode()
return f"data:{mime};base64,{b64}"
if image_urls or video_urls: if image_urls or video_urls:
user_message, log_user_message = await _build_multimodal_content( user_message, log_user_message = await _build_multimodal_content(
+2 -2
View File
@@ -1,7 +1,7 @@
# VITE_API_BASE=http://192.168.120.17:8000 # VITE_API_BASE=http://192.168.120.17:8000
#VITE_API_BASE=https://apiforeign.minzhong.cn #VITE_API_BASE=https://apiforeign.minzhongzc.com
VITE_API_BASE=http://ceshi.apiforeign.minzhongzc.com VITE_API_BASE=https://ceshi.apiforeign.minzhongzc.com
VITE_USE_MOCK=false VITE_USE_MOCK=false
# Encryption disabled for dev — enable in production # Encryption disabled for dev — enable in production
VITE_ENCRYPTION_KEY= VITE_ENCRYPTION_KEY=
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
} }
})(); })();
</script> </script>
<script type="module" crossorigin src="/assets/index-BpUgZBmn.js"></script> <script type="module" crossorigin src="/assets/index-mLPAhw5a.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bsz_Xon-.css"> <link rel="stylesheet" crossorigin href="/assets/index-Bsz_Xon-.css">
</head> </head>
<body> <body>