StaticfunctionalityThis functionality processes uploaded images using a local llama-server process to answer questions about documents. As soon as the file(s) selected changes the AI is contacted via AJAX and the questions are answered. Nothing happens if no file is selected.
PDF Support: The functionality automatically detects PDF files and processes them accordingly:
Image Orientation: The model is sensitive to image rotation. There are two ways to provide orientation of the image to process:
Manual Rotation (Priority): Add a data-cb-Rotate attribute to the input element:
data-cb-Rotate="90" - Rotate image 90° clockwisedata-cb-Rotate="180" - Rotate image 180°data-cb-Rotate="270" - Rotate image 270° clockwise (90° counter-clockwise)Automatic Detection (Fallback): If no data-cb-Rotate attribute is provided AND the Tesseract OCR engine is active (OCR is set in Active_AI plugin property), the system will automatically detect and correct image orientation using Tesseract's OSD (Orientation and Script Detection).
No Rotation: If data-cb-Rotate is not provided and OCR is not set in Active_AI plugin property, images are processed as-is leading to potential wrong results with images that are rotated unless a sophisticated AI model like LLMs is used.
maxPages: Optional number limiting how many pages from a PDF are processed and sent to the AI.
Useful for large PDFs to avoid overwhelming the AI or hitting processing limits.
If set to 0, all pages are processed. Example: maxPages: 5 will
only process the first 5 pages of any PDF. Defaults to 5.
Rotation: Optional attribute on the input element to specify image rotation (see above), either "90", "180", or "270". In a multi-file upload or with a PDF that contains multiple images, this rotation is applied to all files.
MaxPixelSize: Maximum total pixel budget (width×height). Images exceeding this are downscaled client-side while preserving the aspect ratio. Default: 3211264 (≈ 1792×1792). Set to 0 to disable client-side downscaling.
AIHint: Text shown inside AI-populated fields (right-aligned for inputs, bottom-right for textarea) until the user edits the value. Default: "✨ AI-Generated". Set to an empty string to disable.
Note: **According to the EU AI Act, AI-generated content must be clearly labeled. Changing or
disabling the AIHint may lead to non-compliance in certain jurisdictions.**
InternetAccess: If set to true, enables Brave Search internet access for this
functionality instance. The model may use web search results to improve
its answers. Default: false (no internet search).
Thinking: If set to true, enables thinking mode. The AI will use a dedicated
thinking model (if configured) for deeper reasoning. Default: false.
MaxThinkingTokens: Maximum token budget for thinking inference. In verify mode this
defaults to 512 (enough for yes/no reasoning). Set higher if the
model needs more room to reason. Has no effect when Thinking is false.
PositiveResponse: The expected positive answer from the AI in verify mode.
The comparison is case-insensitive by default. Default: "yes".
CaseInsensitive: If true (default), the AI answer is lowercased before comparing
with PositiveResponse. Set to false for an exact (case-sensitive) match.
VerifyErrorText: Error message shown when the file does not pass verification.
Default: "The file does not meet the verification criteria."
VerifyCheckboxLabel: Label for the manual verification checkbox.
Default: "The content is not as expected. Please check if you selected the correct file(s). You may manually verify that it is the correct one by clicking the checkbox."
Mode: If set to "verify", the upload field may have a data-cb-Question attribute. In this case, the question is sent to the AI and the answer must be "yes" (case-insensitive) for the file to be accepted. If not, an error and a manual verification checkbox are shown, just like in ai.ocr.ts. The question can reference symbols as usual.
ResponseLanguage: Two-letter ISO 639-1 code (e.g. "de", "fr"). Forces the AI to
respond in this language, skipping auto-detection. Overrides the
AI_LLAMA_STD_Language plugin property for this instance.
Specialist: Name of a specialist model registered via AI_LLAMA_STD_SPECIALIST_XXX
plugin property. Routes requests to that specialist's dedicated server
instance (case-insensitive match).
QueueBadge: If set to "true", shows a badge with the current queue position while
waiting for inference. Overrides the AI_QueueBadge plugin property
for this instance. Default: determined by plugin property.
QueueText: Text appended after the queue position number in the badge
(e.g. "in queue" → badge shows "3 in queue"). Default: empty.
FilterResults: If set to "true", enables PII filtering on Brave Search queries
for this instance, overriding the global AI_BraveSearch_FilterResults
plugin property. Default: determined by plugin property.
Questions are acquired from DOM elements within the nearest ancestor XContainer of the HTMLInputElement toProcess that're tagged with the class AI_LLAMA_STANDARD_QA_Question. Each such element should have:
Sub-container exclusion: Nested XContainer elements within the search scope can be tagged with the CSS-Class AI_LLAMA_QA_Exclude to exclude their contents from the question search. This allows partitioning a form so that each upload field only picks up its own questions. An upload field that resides inside an excluded sub-container naturally searches that sub-container (its own nearest XContainer) and is not affected by the exclusion.
In verify mode, the upload field itself may have a data-cb-Question attribute. This question is sent to the AI and the answer must be "yes" (case-insensitive) for the file to be accepted. Otherwise, an error and a manual verification checkbox are shown.
Provided by the CodBi.
Provided by the CodBi.
Provides the AI_LLAMA_STANDARD_QA.functionality.
Remarks
Initial Author: Callari, Salvatore (Callari@WaXCode.net) Maintainer: Callari, Salvatore (Callari@WaXCode.net)