feat(regulatory): 输出法规核查过程日志
This commit is contained in:
@@ -57,7 +57,7 @@ def generate_reply(conversation, user_message: str) -> str:
|
||||
raise LLMRequestError("模型接口返回格式不符合预期。") from exc
|
||||
|
||||
|
||||
def generate_completion(messages: list[dict[str, str]], *, temperature: float = 0.0) -> str:
|
||||
def generate_completion(messages: list[dict[str, str]], *, temperature: float = 0.0, timeout: float = 60) -> str:
|
||||
"""Calls the configured chat endpoint with explicit messages and returns assistant text."""
|
||||
|
||||
if not settings.LLM_API_KEY:
|
||||
@@ -84,7 +84,7 @@ def generate_completion(messages: list[dict[str, str]], *, temperature: float =
|
||||
)
|
||||
|
||||
try:
|
||||
with request.urlopen(http_request, timeout=60) as response:
|
||||
with request.urlopen(http_request, timeout=timeout) as response:
|
||||
data = json.loads(response.read().decode("utf-8"))
|
||||
except error.HTTPError as exc:
|
||||
details = exc.read().decode("utf-8", errors="ignore")
|
||||
|
||||
Reference in New Issue
Block a user