system_proxy_enable默认值为False
This commit is contained in:
@@ -13,7 +13,6 @@ from urllib.parse import urlparse
|
|||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from docutranslate.global_values import USE_PROXY
|
|
||||||
from docutranslate.logger import global_logger
|
from docutranslate.logger import global_logger
|
||||||
from docutranslate.utils.utils import get_httpx_proxies
|
from docutranslate.utils.utils import get_httpx_proxies
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ class AgentConfig:
|
|||||||
timeout: int = 1200 # 单位(秒),这个值是httpx.TimeOut中read的值,并非总的超时时间
|
timeout: int = 1200 # 单位(秒),这个值是httpx.TimeOut中read的值,并非总的超时时间
|
||||||
thinking: ThinkingMode = "disable"
|
thinking: ThinkingMode = "disable"
|
||||||
retry: int = 2
|
retry: int = 2
|
||||||
system_proxy_enable: bool = USE_PROXY
|
system_proxy_enable: bool = False
|
||||||
|
|
||||||
|
|
||||||
class TotalErrorCounter:
|
class TotalErrorCounter:
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ from docutranslate import __version__
|
|||||||
from docutranslate.agents.agent import ThinkingMode
|
from docutranslate.agents.agent import ThinkingMode
|
||||||
from docutranslate.agents.glossary_agent import GlossaryAgentConfig
|
from docutranslate.agents.glossary_agent import GlossaryAgentConfig
|
||||||
from docutranslate.exporter.md.types import ConvertEngineType
|
from docutranslate.exporter.md.types import ConvertEngineType
|
||||||
from docutranslate.global_values import USE_PROXY
|
|
||||||
|
|
||||||
# --- 核心代码 Imports ---
|
# --- 核心代码 Imports ---
|
||||||
from docutranslate.global_values.conditional_import import DOCLING_EXIST
|
from docutranslate.global_values.conditional_import import DOCLING_EXIST
|
||||||
@@ -299,7 +298,7 @@ class GlossaryAgentConfigPayload(BaseModel):
|
|||||||
default=default_params["retry"], description="分块失败后的最大重试次数。"
|
default=default_params["retry"], description="分块失败后的最大重试次数。"
|
||||||
)
|
)
|
||||||
system_proxy_enable: bool = Field(
|
system_proxy_enable: bool = Field(
|
||||||
default=USE_PROXY, description="是否使用系统代理", examples=[True, False]
|
default=default_params["system_proxy_enable"], description="是否使用系统代理", examples=[True, False]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -351,7 +350,7 @@ class BaseWorkflowParams(BaseModel):
|
|||||||
description="某个分块翻译失败后的最大重试次数。",
|
description="某个分块翻译失败后的最大重试次数。",
|
||||||
)
|
)
|
||||||
system_proxy_enable: bool = Field(
|
system_proxy_enable: bool = Field(
|
||||||
default=USE_PROXY, description="是否使用系统代理", examples=[True, False]
|
default=default_params["system_proxy_enable"], description="是否使用系统代理", examples=[True, False]
|
||||||
)
|
)
|
||||||
custom_prompt: Optional[str] = Field(
|
custom_prompt: Optional[str] = Field(
|
||||||
None, description="用户自定义的翻译Prompt。", alias="custom_prompt"
|
None, description="用户自定义的翻译Prompt。", alias="custom_prompt"
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ import os
|
|||||||
|
|
||||||
from .conditional_import import available_packages, conditional_import
|
from .conditional_import import available_packages, conditional_import
|
||||||
|
|
||||||
USE_PROXY = True if (os.getenv("DOCUTRANSLATE_PROXY_ENABLED") and os.getenv(
|
USE_PROXY = (
|
||||||
"DOCUTRANSLATE_PROXY_ENABLED").lower() == "true") else False
|
True
|
||||||
|
if (
|
||||||
|
os.getenv("DOCUTRANSLATE_PROXY_ENABLED")
|
||||||
|
and os.getenv("DOCUTRANSLATE_PROXY_ENABLED").lower() == "true"
|
||||||
|
)
|
||||||
|
else False
|
||||||
|
)
|
||||||
if USE_PROXY:
|
if USE_PROXY:
|
||||||
print(f"USE_PROXY:{USE_PROXY}")
|
print(f"USE_PROXY:{USE_PROXY}")
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ default_params = {
|
|||||||
"concurrent": 30,
|
"concurrent": 30,
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
"timeout": 1200,
|
"timeout": 1200,
|
||||||
"retry": 2
|
"retry": 2,
|
||||||
|
"system_proxy_enable": False
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user