Hi,
i use Chatscript as an embedded component in my system.
What I want to achieve
I have a component which will display the messages like a messenger, e.g. whatsapp, and saves all sent and received messages.
- At some point, I want to replace parts of the history with alternative message contents.
- One answer of chatscript can contain more messages belonging to both sides (user and chatbot) in order to simply add parts of the chat.
How I thought of doing this
Chatscript will provide each answer in a defined format, providing different versions of this part of the chat and using || to achieve that i can generate more that one chat message for each call of the PerformChat function:
DEFAULT || USERINPUT || BOTOUTPUT
FLAGX=1 || USERINPUT || BOTOUTPUT || USERINPUT || BOTOUTPUT ....
...
FLAGX=N || USERINPUT || BOTOUTPUT || USERINPUT || BOTOUTPUT ....
e.g.
DEFAULT || ORIGINAL|| default answer
FLAGA=1 This would be a replacement for the user input || This is the bot answer || This is another user input || This is the next bot answer
FLAGA=2 ORIGINAL || Here only the bot answer is changed
The key word ORIGINAL would mean that the user input isn´t replaced in that variant.
At a later time i could do
[SET FLAGA=2]
in the oob communication to tell my component that it should display a different version of the communication.
In Chatscript i would use the post controlscript to generate this formats.
The default case would be to generate the sequel from “botoutput” to “DEFAULT || botoutput”
Via macros i would provide functions like ^addBotOutput or ^changeUserInput or addNewVariant(FLAGASSIGNMENT) and stuff like that.
My Questions
- Do you have some feedback to my solution?
- Is there any way chatscript can provide me further support with this?
e.g. is there a way to add a check that the flagassignments are correct and that if I later change a flag that this flag is set somewhere else (to avoid spellerrors etc)
- Maybe you have some idea to achieve my goal using a completely different way?