8000 feat(documents): read documents with an Apache Tika server by adeelahmad · Pull Request #292 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The backend (`fastapi_backend`) and the frontend (`nextjs-frontend`) are version

## Unreleased

- **Apache Tika.** Lens can use an Apache Tika server (`--profile tika` in the compose files, or one of your own, set
in Settings → Documents). Documents nothing here can make into a PDF, such as Word files on a lean server or a
Raspberry Pi, are read by Tika as text, and every document's own title, authors, language and dates are read as
Dublin Core terms. Off until a Tika server is set ([Configuration](docs/configuration.md#apache-tika)).
- **New pipelines, workflows, templates and API tokens come with a name.** The web app guesses one from what you're
making ("Transcribe to report", "Recording workflow", "Prompt template 2", "Read only token"), as it already did for
routines, so making one takes no typing; type a name to choose your own. The pencil next to the name renames it
Expand Down
2 changes: 1 addition & 1 deletion ci/clicks/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stop() {
wait "$p" 2>/dev/null || true
kill "$w" 2>/dev/null || true
done
rm -rf "$tmp"
rm -rf "$tmp" 2>/dev/null || { sleep 2; rm -rf "$tmp" || true; }
}
trap stop EXIT INT TERM

Expand Down
15 changes: 15 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,21 @@ services:
restart: unless-stopped
networks: [lens]

# Apache Tika (docs/configuration.md#apache-tika): reads the text and description of about a thousand kinds of file where Lens can't make
# them into PDFs itself, and what every document says about itself. Opt-in, about 250 MB of memory:
# `docker compose --profile tika up -d` (or COMPOSE_PROFILES=tika in .env), then Settings → Documents → Tika server:
# http://tika:9998. Reachable only inside Lens's network; it has no sign-in of its own.
tika:
image: apache/tika:${TIKA_VERSION:-4.0.0-1}
profiles: [tika]
security_opt: ["no-new-privileges:true"]
read_only: true
tmpfs: [/tmp]
environment:
JAVA_TOOL_OPTIONS: -Xmx${TIKA_HEAP:-512m}
restart: unless-stopped
networks: [lens]

# The MCP runner (mcp-runner/runner.py, docs/assistant.md): MCP servers that run as a program (stdio, usually npx or
# uvx), which admins add as extensions. Opt-in: `docker compose --profile mcp up -d`, or COMPOSE_PROFILES=mcp in .env.
# The sandbox: none of Lens's data or keys, no capabilities, a read-only image, and a network shared only with the
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ services:
- matterbridge-data:/matterbridge
networks: [lens]

# Apache Tika (docs/configuration.md#apache-tika): reads the text and description of about a thousand kinds of file where Lens can't make
# them into PDFs itself, and what every document says about itself. Opt-in, about 250 MB of memory:
# `docker compose --profile tika up -d` (or COMPOSE_PROFILES=tika in .env), then Settings → Documents → Tika server:
# http://tika:9998. Reachable only inside Lens's network; it has no sign-in of its own.
tika:
image: apache/tika:${TIKA_VERSION:-4.0.0-1}
profiles: [tika]
security_opt: ["no-new-privileges:true"]
read_only: true
tmpfs: [/tmp]
environment:
JAVA_TOOL_OPTIONS: -Xmx${TIKA_HEAP:-512m}
networks: [lens]

# The MCP runner (mcp-runner/runner.py, docs/assistant.md): MCP servers that run as a program (stdio, usually npx or
# uvx), which admins add as extensions. Opt-in: `docker compose --profile mcp up -d`, or COMPOSE_PROFILES=mcp in .env.
# The sandbox: none of Lens's data or keys, no capabilities, a read-only image, and a network shared only with the
Expand Down
5 changes: 4 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,10 @@ made, unless someone named or dated it. Its attachments are kept as its files (r
read become resources of their own beside it, each with `attached_to: {resource, file, title}` (the email, and its
title when the caller may see it); an attachment file's `resource` is the resource it became, or the one it was already
in the namespace (`documents.attachment_resources`). Transcribing an email again keeps and makes nothing twice.
`GET /uploads/limits` says what the server can convert (`convert: {office, pages, msg}`); an upload it can't read is
`GET /uploads/limits` says what the server can convert (`convert: {office, pages, msg, tika}`); with an
[Apache Tika](configuration.md#apache-tika) server set, what nothing else can convert is read by Tika as text without
pages (`engine` `text:tika`), and every document has `described`, what it says about itself as Dublin Core terms
(`POST /settings/documents/tika/test` checks the server). An upload it can't read is
refused, saying what it needs, and the files that can be transcripts too (PDFs, Word, text and Markdown) can be imported
as transcripts instead (`POST /import`). Its pipeline's read step (its transcribe step, for a document or an image:
no speech model is fetched for one) draws its pages and reads their text: a PDF's own text, block by block with where each block is on its page (poppler's
Expand Down
34 changes: 34 additions & 0 deletions docs/configuration.md