Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Web app

Reference

Assistant and chat screens

Reference for assistant.js, chat-task.js, and widget-ai.js, covering the chat screen and home widget of the intent assistant, and task cards.

The web app has a chat screen for the intent assistant and a home widget that shares the same conversation. The client only renders: every message goes to POST /api/v1/chat/message, and the server decides the reply. This page lists what the client sends, how it renders each reply part, and how task cards collect a record step by step. The engine is described on intent assistant.

Scope and source

  • Defined in: webapp/js/assistant.js (renderAssistant, ensureAssistant, askAssistant, getConversation, subscribeConversation, resetAssistant), webapp/js/chat-task.js (ChatTask, createTaskCard), webapp/js/widget-ai.js (renderAiWidget)
  • Count: 4 reply parts handled by renderReply (webapp/js/assistant.js:194-199)

Opening the assistant

Entry Source
The assistant app, manifest id ai-assistant with screen: "assistant" src/cluster_erp/modules/app_store/catalog.json:131-139, webapp/js/home.js:2425-2426
The assistant button on the home status line (chat.title) webapp/js/home.js:152-155
The home widget with key ai webapp/js/home.js:292-302

Request

sendToEngine(payload) posts {text, allowed_modules, ...payload} to /chat/message. allowed_modules is the installed-app scope from app-scope.js; the comment states that the engine answers only within these modules and the caller's permissions (webapp/js/assistant.js:201-217). See module apps and app scope.

While a task card is active, typed text does not go to the engine. A cancel word cancels the card; anything else is answered with chat.task.use_card (webapp/js/assistant.js:252-264).

Reply parts

Part Rendering Source
content An assistant bubble webapp/js/assistant.js:195
navigate_to A bubble with chat.cannot_navigate webapp/js/assistant.js:196
actions A row of buttons; a navigate action also answers with chat.cannot_navigate webapp/js/assistant.js:139-166, webapp/js/assistant.js:197
task_card A task card in the conversation webapp/js/assistant.js:167-192, webapp/js/assistant.js:198

An error answer is shown as an assistant bubble with the translated error text (webapp/js/assistant.js:211-215).

Conversation

The conversation lives in memory for the session and keeps at most 200 messages (webapp/js/assistant.js:17, webapp/js/assistant.js:84-90). The chat screen and the widget share it through getConversation and subscribeConversation (webapp/js/assistant.js:420-437). The widget shows the last 40 entries and offers starter chips from each installed module's assistant_starters metadata (webapp/js/widget-ai.js:18-28). tests/test_metadata_driven_rules.py:77 checks that starters are module metadata in both languages.

The screen also shows file chips for attached files and a voice recorder with a timer (webapp/js/assistant.js:275-320). The header comment calls the recorder cosmetic (webapp/js/assistant.js:1-6); a files-only message shows the chips and sends nothing to the engine (webapp/js/assistant.js:262).

resetAssistant() discards the conversation, the active card, and pending files on logout and when the app is closed from the switcher (webapp/js/assistant.js:457-467, webapp/js/main.js:167, webapp/js/home.js:2545).

Task cards

A task card is the client side of a server TaskCardOut: an entity type and label, a module, an API path, and a list of fields (webapp/js/chat-task.js:1-5, webapp/js/chat-task.js:13-38).

Step Behaviour Source
One field per step Back, skip (for optional fields), and next webapp/js/chat-task.js:47-80
Conditions A field whose condition does not hold is skipped webapp/js/chat-task.js:99-103
Foreign-key search Options come from GET /<module><endpoint> of the field's source webapp/js/chat-task.js:300-315
Summary An editable summary of every answer webapp/js/chat-task.js:81-87, webapp/js/chat-task.js:122-135
Submit POST of the collected data to the card's API path webapp/js/chat-task.js:466-480

When the module of an active card leaves the installed-app scope, the card is cancelled (webapp/js/assistant.js:220-230).

Constraints and validation

  • The server enforces permissions for every message and every submit; the client's scope only narrows what it asks for.
  • Browser tests: web-client/_e2e_assistant.mjs, web-client/_e2e_widgets_ai_sched.mjs.

Terms introduced

Term Code identifier Definition Turkish term Source
task card createTaskCard A step-by-step form in the conversation, built from metadata for a create intent, that creates one record. görev kartı webapp/js/chat-task.js:149
starter chip assistant_starters A one-tap question a module offers in the assistant widget. başlangıç önerisi webapp/js/widget-ai.js:22-28
allowed modules allowed_modules The installed-app scope sent with every chat message. izinli modüller webapp/js/assistant.js:209

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13