You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

1.6 KiB

name description
fetch-raw-file Lấy URL download file PDF/XLSX/DOCX gốc theo file_id. Dùng khi user muốn xem hoặc tải file nguồn để kiểm tra nội dung.

Fetch Raw File URL

Khi nào dùng

  • "Cho tôi xem file gốc của tài liệu X"
  • "Tôi muốn download PDF này"
  • "Link tải file gốc?"
  • "Mở file để tôi check lại"

Workflow

  1. Cần file_id (integer). Cách lấy:
    • Từ kết quả describe_entity (mỗi file có id).
    • Từ payload của search_procurement_docs (chứa file metadata).
  2. Gọi fetch_raw_file_url(file_id=<id>).
  3. Xử lý lỗi:
    • public_base_url not configured → "Server chưa config public URL, liên hệ admin."
    • file_not_found → "Không tìm thấy file_id <id>, vui lòng kiểm tra lại."
  4. Nếu OK: trả URL dạng clickable link kèm filenamecontent_type để user biết file gì trước khi click.

Ví dụ

Agent:

→ fetch_raw_file_url(file_id=42)
← {url: "http://100.123.9.15:8000/files/42/raw", filename: "tender.pdf", content_type: "application/pdf"}

Reply: "📄 tender.pdf — PDF, click để download."

Anti-patterns

  • Đừng tự bịa URL — phải gọi tool để lấy URL đúng (URL phụ thuộc cấu hình PUBLIC_BASE_URL của server, không cố định).
  • Đừng giấu URL — luôn show để user click được.
  • Đừng gọi tool này nếu user chỉ hỏi nội dung — dùng search_procurement_docs thay vì.
  • Đừng đoán file_id — phải có từ describe_entity hoặc search results trước.