Project

General

Profile

Actions

Feature #3177

open

Implementing dialogs

Added by Gregory Magarshak 6 months ago.

Status:
New
Priority:
Urgent
Start date:
11/24/2024
Due date:
12/18/2024 (about 5 months late)
% Done:

0%

Estimated time:
10.00 h

Description

It would be nice to have a declarative language, using a JSON schema, to design dialogs between bots and users, not just for Telegram but more generally. Later, it will be expanded to use natural language with AI.

A dialog is a short part of a conversation, which starts with a command, and results in a few prompts (for predefined enumerated answers from a Telegram keyboard, and the fields entered into the prompts are sent to a handler, which eventually returns true when everything has been entered). After calling the handler, you're supposed to open a JSON file inside the uploads folder, and update it with the latest fields. When the dialog is complete, the handler is run to "handle" this JSON file, by default it would save the fields to Users_Fields rows with all columns including dialogId, insert using insertManyAndExecute. In this way, our bots can gather information on users (and share it, since the xid is the same across all bots).

The dialogs may in the future be graphical GUI dialogs in our website, or they may be Telegram bots having a conversation with people.

Here is the specification:
https://issues.qbix.com/projects/q/wiki/Dialogs

Please implement it in the Users plugin, meaning no mention of higher plugins like Streams and Telegram. It should write files to the correct folder, and can later remove the folder if the final handler returns true.

Handle the final handler throwing errors.

Then, after implementing it in Users plugin, add support in Telegram plugin (this should be just a few lines of code) which sendMessage to the user, and keep track of their answer. Please use the deterministic bot session to know which dialog the

No data to display

Actions

Also available in: Atom PDF