buerokratt / Buerokratt-Chatbot

1 stars 18 forks source link

Possibility to send attachments as part of a conversation #30

Open rasmusei opened 2 years ago

rasmusei commented 2 years ago

AS AN End User and CSA I WANT TO be able to send attachments via chatbot SO THAT I could provide other party necessary information

Acceptance Criteria

Settings

DSL

GUI

To Consider

turnerrainer commented 2 years ago
PaulaMerle commented 1 year ago

DSL for phase 3 development

sergeirudz commented 1 year ago

@turnerrainer This is how its currently implemented: PR which will have to be updated: https://github.com/buerokratt/Chat-Widget/pull/12

Implementation:

export interface MessageFile {
   name: string;
   type: MessageFileTypes;
   size: number;
   base64: string;
}
export interface Message {
   chatId: string | null;
   id?: string;
   content?: string;
   file?: MessageFile; // ←—------ Added this
   event?: string;
   rating?: string;
   authorId?: string;
   authorTimestamp: string;
   authorFirstName?: string;
   authorLastName?: string;
   authorRole?: string;
   created?: string;
   updated?: string;
   data?: {
       forwarding_validation?: string;
   };
}
export enum MessageFileTypes {
   // TODO add correct file types Ticket: https://github.com/buerokratt/Buerokratt-Chatbot/issues/30
   PDF = 'application/pdf',
   PNG = 'image/png',
   JPEG = 'image/jpeg',
   TXT = 'text/plain', // TODO SLICE NAME
   DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // TODO SLICE NAME
   ODT = 'application/vnd.oasis.opendocument.text', // NOT SPECIFIED
   XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // TODO SLICE NAME
   // ODS = 'ods', // NOT SPECIFIED
   BDOC = 'application/vnd.etsi.asic-e+zip', // TODO VERIFY, could not find an example
   CDOC = 'application/x-cdoc', // NOT SPECIFIED
   ASICE = 'application/vnd.etsi.asic-e+zip', // TODO SLICE NAME
   MP3 = 'audio/mpeg', // TODO VERIFY, could not find an example
   WAV = 'audio/wav', // TODO VERIFY, could not find an example
   M4A = 'audio/x-m4a',
   MP4 = 'video/mp4',// TODO
   WEBM = 'video/webm',// TODO
   OGG = 'video/ogg',// TODO
   MOV = 'video/quicktime',// TODO
}

Questions:

  1. Where is the data structure that specifies message with file attachment? Will the file message just contain the URL to CDN to download the file?
  2. Where is the design for the chatbot widget file upload? Upload file paperclip icon, chat bubble with file sent/received, delete file and cancel the upload.
  3. Upload progress bar for slow connections.
  4. Are the file formats sufficient? I added some additional.
  5. Implementation on the CSA side should be identical?
  6. How to pick the correct object structure for file message?
export interface MessageFile {
   name: string;
   type: MessageFileTypes;
   size: number;
   base64?: string; ←— base64 file when sending message. Empty when receiving.
   url?: string;  ←— file download link will be added here when receiving message! Or combine them both into data: ""?
}`
sergeirudz commented 1 year ago

Chat-Widget implementation

https://github.com/buerokratt/Chat-Widget/pull/12 Currently, Work In Progress!

turnerrainer commented 1 year ago

@sergeirudz

Will the file message just contain the URL to CDN to download the file?

Ruuter DSL will contain appropriate headers to force the browser to download the file. No need for a CDN link.

turnerrainer commented 1 year ago

@sergeirudz

GUI has to make a POST request towards Ruuter endpoint /attachments/add with the content described by you:

export interface MessageFile {
   name: string;
   type: MessageFileTypes;
   size: number;
   base64: string;
}
sergeirudz commented 1 year ago

PR: https://github.com/buerokratt/Chat-Widget/pull/12 Added POST request to '/attachments/add'

I added chatId key!!!

export interface Attachment {
    chatId: string;
    name: string;
    type: AttachmentTypes;
    size: number;
    base64: string;
}
export enum AttachmentTypes {
    PDF = 'application/pdf',
    PNG = 'image/png',
    JPEG = 'image/jpeg',
    TXT = 'text/plain',
    DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    ODT = 'application/vnd.oasis.opendocument.text',
    XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
    ODS = 'ods',
    BDOC = 'application/vnd.etsi.asic-e+zip',
    CDOC = 'application/x-cdoc',
    ASICE = 'application/vnd.etsi.asic-e+zip',
    MP3 = 'audio/mpeg',
    WAV = 'audio/wav',
    M4A = 'audio/x-m4a',
    MP4 = 'video/mp4',
    WEBM = 'video/webm',
    OGG = 'video/ogg',
    MOV = 'video/quicktime',
}
sergeirudz commented 1 year ago

Widget Branch https://github.com/sergeirudz/Chat-Widget/tree/30-possibility-to-send-attachments PR: https://github.com/buerokratt/Chat-Widget/pull/12

Admin Ticket buerokratt/Buerokratt-Chatbot#30 Admin poolne tehtud https://github.com/buerokratt/Buerokratt-Chatbot/issues/30 PR: https://github.com/buerokratt/Buerokratt-Chatbot/pull/180

PaulaMerle commented 10 months ago

@turnerrainer lets have 3 options in admin module (in Vestlusrobot -> Seaded page) for attachments: 1) end-user to CSA attachments allowed/not allowed; 2) end-user to CSA attachments allowed only if end-user is authenticated (needs authentication to be triggered after pressing attachment button); 3) CSA to end-user attachments allowed/not allowed. Each organization can decide by themselves whether they allow attachments to be sent. In case allowed - should the attachments be downloaded first in order to open or can be opened immediately from chat?