Skip to content

Add Long Text to custom field type selector - #220

Closed
rsaether76 wants to merge 1 commit into
admonstrator:mainfrom
rsaether76:agent/add-longtext-custom-field-option
Closed

rsaether76 wants to merge 1 commit into
admonstrator:mainfrom
rsaether76:agent/add-longtext-custom-field-option

Conversation

@rsaether76

Copy link
Copy Markdown
Contributor

Summary

Adds Paperless-ngx longtext as a selectable custom field type in the Paperless-AI Next settings UI.

Paperless-AI Next already preserves configured longtext custom fields through CUSTOM_FIELDS, and the shared custom field validator only applies the 128-character length guard to string fields. This change lets users select long text fields from the settings page instead of manually editing Docker environment JSON.

Changes

  • Adds Long Text / longtext to the custom field type dropdown in views/settings.ejs.
  • Adds a lightweight regression test that checks the settings template exposes the longtext option.
  • Registers the new test in the existing test runner under the processing area.

Testing

node scripts/run-tests.js --test custom-field-longtext-ui
node --check scripts/run-tests.js
git diff --check

@rsaether76
rsaether76 marked this pull request as ready for review July 9, 2026 16:43
@admonstrator admonstrator self-assigned this Jul 16, 2026
@admonstrator admonstrator added the enhancement New feature or request label Jul 16, 2026
@admonstrator admonstrator added this to the v2026.08.01 milestone Jul 16, 2026
@admonstrator

Copy link
Copy Markdown
Owner

Thanks a lot, @rsaether76! The Long text option is now part of #364, rebuilt on the current settings markup and with a test for the validator and the selector. You are credited as a co-author on the commit. Closing this in favour of #364.

OvisMaximus added a commit to OvisMaximus/zettelrobbe that referenced this pull request Oct 4, 2026
Background
Brings in 34 upstream commits up to v2026.09.03: the shared
documentProcessingService write-back (admonstrator#255), the entity creation guard and
the Duplicates / "Simplify tags" pages, long text custom fields (admonstrator#220), the
ai-processed tag on untagged documents (admonstrator#248), the container restart loop fix
(admonstrator#241), the Playground removal (admonstrator#359) and dependency bumps.

Changes
- Write-back: buildUpdateData()/saveDocumentChanges() in server.js,
  routes/setup.js and mistralOcrService.js are replaced by upstream's
  documentProcessingService. The local helpers in
  services/dataProcessingUtils.js were a subset of it and are removed.
- The local trigger-tag removal (REMOVE_TRIGGER_TAGS in predefined mode)
  moved from server.js into documentProcessingService.saveDocumentChanges(),
  so it now applies to the scan, the queue and the OCR path alike.
- paperlessService keeps the CachedNameIdEnum caches for tags,
  correspondents and document types. Upstream's creation guard runs after
  the enum lookup; _guardEntitiesFromTagCache() reads the enum instead of
  the removed tagCache Map.
- clearTagCache() now invalidates the tag and correspondent enums instead
  of refilling them right away (as its doc comment already said);
  clearDocumentTypeCache() also invalidates the document type enum.
  CachedNameIdEnum gains invalidate().
- listCorrespondentsNames()/listDocumentTypesNames() return { id, name }
  objects again. They returned bare strings, which broke every caller that
  maps `.name` (scan prompt lists, OCR path, dashboard list, Simplify).
- Playground removed as upstream did, including the local
  analyzePlayground() in ollamaService and its truncation test cases.
- Tests: run-tests.js lists both sides' tests; upstream tests that poked
  paperlessService.tagCache use the enum API; entity-creation-guard cases
  now use names the enum lookup does not match, plus a case that pins the
  enum mapping a name holding every word of an existing correspondent.
- Prettier applied to paperlessService.js and serviceUtils.js; OpenAPI
  regenerated (identical to upstream).

Testing
node scripts/run-tests.js --all on Windows with Node 26: 100 passed,
7 skipped, 16 failed. All 16 fail the same way on plain upstream/main or
on the pre-merge HEAD: Windows temp-dir EBUSY/EPERM on cleanup, CRLF
working-tree copies of the CSS (icon-sizing), upstream's changelog lagging
its v2026.09.03 bump (changelog-releases), and the local
llm-ocr-fallback-phrases refactoring test. ESLint and Prettier clean on
the touched files.

Impact
Prefix-like correspondent proposals are still mapped by the local enum
lookup before upstream's guard can only hint at them; the guard records
mappings only for names the lookup does not resolve.

Upstream Status
Merge of upstream/main at 1836fc9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
admonstrator pushed a commit that referenced this pull request Oct 5, 2026
Background:
The automated bump in 1836fc9 set PAPERLESS_AI_VERSION to v2026.09.03
without a matching block in config/changelog.js, so
test-changelog-releases fails on main and on every PR against it, and
the What's New modal still shows v2026.09.02.

Changes:
- config/changelog.js: v2026.09.03 block summarising what landed on
  main since v2026.09.02 (#220/#255 long text custom fields and the
  type check, #255 history and log fixes, #248 ai-processed tag,
  #241 restart loop, #359 Playground removal).

Testing:
- node scripts/run-tests.js --all: 111 passed, 6 skipped, 0 failed.

Impact:
Release notes only; no behaviour change.

Upstream Status:
Not applicable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiLkccEvCtMAgcB1g5dSNM
0cyris pushed a commit to 0cyris/paperless-ai-next that referenced this pull request Oct 16, 2026
…ator#220, admonstrator#255)

Background
Paperless-ngx has a `longtext` custom field type without the 128-character
limit of `string`. The processing path already handled it: the validator
applies the length guard to `string` only, the prompt builders treat any
other type as free text, and the settings route stores whatever type it is
given. Only the type selector in Settings lacked the option, so using a long
text field meant editing the CUSTOM_FIELDS JSON by hand. PR admonstrator#220 and PR admonstrator#255
both add the option.

Changes
- Settings: add "Long text" (`longtext`) to the custom field type selector
  and label `string` as "Text (up to 128 characters)", so the difference is
  visible where the type is chosen.
- New offline test `custom-field-longtext`: a longtext value over 128
  characters passes validation unchanged (line breaks included), a string
  value over 128 is still skipped, and the selector offers both types.
  Registered in the runner under the processing area.

Not taken from admonstrator#255: the buildUpdateData refactor into
dataProcessingUtils.js (the pipeline is being unified separately), the
Ollama change (hard-coded num_ctx 32k and num_predict -1 override the
configured context and RESPONSE_TOKENS budget), and the IDE files.

Testing
- node scripts/run-tests.js --test custom-field-longtext: passes; fails
  against the old view.
- node scripts/run-tests.js --all in a clean worktree: 108 passed,
  7 skipped (need a running server or pdftoppm), 0 failed.
- eslint and prettier clean on the changed JS files.

Impact
UI only: one more option in the custom field type selector. No change to
processing, the API or stored configuration.

Upstream Status
Not applicable (fork-only UI).

Co-Authored-By: rsaether76 <264263539+rsaether76@users.noreply.github.com>
Co-Authored-By: OvisMaximus <5701377+OvisMaximus@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants