Skip to content

PDF upload + local Ollama models returns "encrypted/random characters” instead of reading document #106

@nga10601

Description

@nga10601

Preflight Checklist

Surf Version

1.4.3-beta.0

What operating system(s) are you using?

macOS

Operating System Version

MacOS Tahoe 26.3

What arch are you using?

arm64 (including Apple Silicon)

Expected Behavior

The PDF upload / sidebar integration should extract text from the PDF and send that text to the local model.

The model should be able to summarize, answer questions, and generally interact with the document content, similar to when plain text is pasted.

Actual Behavior

With the PDF upload / sidebar flow and local models:

  • llama3.1:8b responds that the PDF appears to be encrypted or unreadable.

  • phi4-mini:3.8b responds that the PDF appears to be a random string of characters/symbols.

With the same document, if copy a passage from the PDF and paste it as plain text into a chat, both models work correctly and answer questions about the content.

Additional Information

This is the case across many PDF documents, which I know are not encrypted. This makes context-aware chats unusable when dealing with PDFs. I can't test this using ChatGPT, Claude, or Gemini.

I'm not very knowledgeable about how Surf works, but my guess is that Surf is currently passing the PDF (or some binary/base64 representation) directly to the model, rather than extracting text before calling my local models. Is Surf expected to run a PDF‑to‑text pipeline when using custom/Ollama backends, or is this only implemented for the previous hosted AI service?

Steps to Reproduce:

  1. Configure Surf to use a local AI backend via Ollama:

    Endpoint: http://localhost:11434
    Default model: llama3.1:8b (also tested with phi4-mini:3.8b).

  2. In Surf, upload a regular text‑based PDF through Finder (not scanned, not copy/paste from Preview).

  3. Open the PDF in Surf.

  4. Open the AI sidebar and ask a question like:

    “Summarize the contents of this page.”
    “What is the main argument in this PDF?”

  5. Observe the model response.

(As a control, start a new note with the same model in Surf, upload the same PDF directly into the chat via "Add Context", and ask a similar question. This returned the same response as using the sidebar).

(As a second control, copy a few paragraphs from the PDF, paste them as plain text into a chat with the same model, and ask a question. This works perfectly fine for me).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions