feat(nanoclaude): document.ask 10초 후 "자료를 분석하고 있습니다..." 안내
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -368,7 +368,7 @@ async def run(job: Job) -> None:
|
||||
notice = "서고를 확인하는 중입니다..."
|
||||
await send_to_synology(notice, raw=True)
|
||||
|
||||
# 일반 도구 실행 (document.ask는 긴 timeout)
|
||||
# 일반 도구 실행 (document.ask는 긴 timeout + 중간 안내)
|
||||
timeout = DOCUMENT_ASK_TIMEOUT if (tool_name == "document" and operation == "ask") else TOOL_TIMEOUT
|
||||
doc_start = time()
|
||||
if tool_name == "document":
|
||||
@@ -377,10 +377,28 @@ async def run(job: Job) -> None:
|
||||
any(k in job.message.lower() for k in ["산업안전", "위험성평가", "asme", "법령"]),
|
||||
any(s in job.message.lower() for s in ["목록", "리스트", "제목만"]),
|
||||
params.get("query", "")[:50])
|
||||
|
||||
# document.ask는 Gemma 분석으로 오래 걸림 → 10초 후 중간 안내
|
||||
if tool_name == "document" and operation == "ask" and job.callback == "synology":
|
||||
tool_task = asyncio.create_task(
|
||||
asyncio.wait_for(execute_tool(tool_name, operation, params), timeout=timeout)
|
||||
)
|
||||
analyze_notice_sent = False
|
||||
while not tool_task.done():
|
||||
await asyncio.sleep(2)
|
||||
if not tool_task.done() and not analyze_notice_sent and (time() - doc_start) >= 10:
|
||||
await send_to_synology("자료를 분석하고 있습니다...", raw=True)
|
||||
analyze_notice_sent = True
|
||||
try:
|
||||
result = tool_task.result()
|
||||
except asyncio.TimeoutError:
|
||||
result = {"ok": False, "tool": tool_name, "operation": operation, "data": [], "summary": "", "error": "⚠️ 서비스 응답 시간이 초과되었습니다."}
|
||||
else:
|
||||
try:
|
||||
result = await asyncio.wait_for(execute_tool(tool_name, operation, params), timeout=timeout)
|
||||
except asyncio.TimeoutError:
|
||||
result = {"ok": False, "tool": tool_name, "operation": operation, "data": [], "summary": "", "error": "⚠️ 서비스 응답 시간이 초과되었습니다."}
|
||||
|
||||
if tool_name == "document":
|
||||
logger.info("Job %s document.%s ok=%s elapsed=%.1fs", job.id, operation, result.get("ok"), time() - doc_start)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user