AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

trouble with cs_control_main and cs_control_post

From my control script

$userprompt = ^"%user: >"
$botprompt = ^"LISA: "

$cs_control_main = ~swgcontrol
= ~swgpost

defaultbot (^name)
createfact(^name defaultbot defaultbot)

: ~swgpost system () # should be called for post processing.
t: (^query(direct_v chatoutput ? -? @9  ))
logpost processing with weird matcher)

t: ( ) ^login post process man\n)

t: () ^login post process dude\n)
log( ^"prepending oobOutData to output: ^jsontree($$oobOutData) ")

topic: ~swgcontrol system ()
PARSE_OOB_DATA (\[ _* ) 
$oobInData = ^jsonparsetransient NOFAIL _0
$oobInDataString = ^jsontree($$oobInData)
logit(info ^"jsontree: $$oobInDataString ")
$channelData = $$oobInData.channelData
^logit(info ^"channelData: $$channelData")

logitinfo ^"creating oobOutData object!")
$oobOutData = ^jsoncreate(object)
$$oobOutData.channelData = $$channelData 
: () # main per-sentence processing
^logit info ^" ===== new volley: cs_control_main: $cs_control_main cs_control_post: $cs_control_post ====" 

In this scenario, No processing happens at all.

If I change the $cs_control_main to be ~control then I get the log info to show up in the control topic and it shows the value of $cs_control_main to be ~control but there is no value for $cs_control_post.

In either scenario, I never get anything to happen in the post processing topic.

I have tried stopping and restarting the server with no change. I always do a :build Lisa0. I have verified that changes in the control script are getting picked up by modifying the log text which I am seeing output in the log file.

Are there things that will cause $cs_control_post to be ignored or overwritten?

Stephen G.


  [ # 1 ]

if you log in with the same name, you get old values of variables.  You can do :reset to be clear.


  [ # 2 ]

The bot initialization function, lisa(), in this case, but it looks like the definition was missed from the code you pasted, is only run once for each user, on the first time that user interacts with your bot. Therefore if you make any changes to that macro they are not seen be existing users.

A :reset will clear the user’s topic file for the bot which will solve the problem but has the side effect of removing all context and state for that user.

We have our update update topic and a variable to track an internal version number so if we need to make changes to the bot function then we also increment this version and have an update rule to make the equivalent change for existing users.


  login or register to react