summaryrefslogtreecommitdiff
path: root/src/ollama_web/tools
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-06-24 18:11:10 +0900
committertanaka takashi <isazaka@gmail.com>2026-06-24 18:11:10 +0900
commitf7e2894856c10d8a1e2d429a7858d9f143c42404 (patch)
treefc916d63947acead39868968db26ecd80854579c /src/ollama_web/tools
parent374ba05fe2a4022d95ed45322a13e9eef3ed59de (diff)
Web検索などのツール呼び出しによる応答不能を回避
Diffstat (limited to 'src/ollama_web/tools')
-rw-r--r--src/ollama_web/tools/pdf.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ollama_web/tools/pdf.py b/src/ollama_web/tools/pdf.py
index 8dc5abb..815c053 100644
--- a/src/ollama_web/tools/pdf.py
+++ b/src/ollama_web/tools/pdf.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+import io
from pathlib import Path
from pypdf import PdfReader
@@ -25,7 +26,7 @@ def extract_pdf_text(data: bytes, max_chars: int | None = None) -> str:
limit = max_chars if max_chars is not None and max_chars > 0 else settings.fetch_max_chars
try:
- reader = PdfReader(stream=data)
+ reader = PdfReader(stream=io.BytesIO(data))
except Exception as exc: # noqa: BLE001
return f"Failed to parse PDF: {exc}"