refactor(models, helper): update identifiers and proxy transport code

- Renamed `model_identity` to `dify_model_identity` for clearer specificity
- Added `proxy` parameter to `httpx.HTTPTransport` for SSRF protection adjustments
This commit is contained in:
-LAN- 2024-10-01 13:06:30 +08:00
parent afb3e317d3
commit 5c64792793
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ class FileExtraConfig(BaseModel):
class File(BaseModel):
model_identity: str = FILE_MODEL_IDENTITY
dify_model_identity: str = FILE_MODEL_IDENTITY
id: Optional[str] = None # message file id
tenant_id: str

View File

@ -15,8 +15,8 @@ SSRF_DEFAULT_MAX_RETRIES = int(os.getenv("SSRF_DEFAULT_MAX_RETRIES", "3"))
proxy_mounts = (
{
"http://": httpx.HTTPTransport(SSRF_PROXY_HTTP_URL),
"https://": httpx.HTTPTransport(SSRF_PROXY_HTTPS_URL),
"http://": httpx.HTTPTransport(proxy=SSRF_PROXY_HTTP_URL),
"https://": httpx.HTTPTransport(proxy=SSRF_PROXY_HTTPS_URL),
}
if SSRF_PROXY_HTTP_URL and SSRF_PROXY_HTTPS_URL
else None