-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Overriding a bot on a stage breaks DialogEngine and fails to update content-elements #1581
Closed
daukadolt opened this issue
Dec 22, 2021
· 3 comments
· Fixed by botpress/studio#229, botpress/botpress#11631 or botpress/botpress#11643
Closed
[BUG] Overriding a bot on a stage breaks DialogEngine and fails to update content-elements #1581
daukadolt opened this issue
Dec 22, 2021
· 3 comments
· Fixed by botpress/studio#229, botpress/botpress#11631 or botpress/botpress#11643
Labels
bug
Something isn't working
Comments
const STAGE_SEPERATOR = '__'
const VERSION_SEPERATOR = ' :: v'
const STAGE_KEY = `${botId}-PipelineVersion`
const getPromoteVersionStage = () => {
if (pipeline.length < 2) return 'NEVER'
let stage2 = pipeline[1]
return stage2.id
}
const getNextVersion = async () => {
const promoteVersion = getPromoteVersionStage() === bot.pipeline_status.stage_request.id
let globalKvs = bp.kvs.global()
let storeExists = await globalKvs.exists(STAGE_KEY)
let curVersion = storeExists ? await globalKvs.get(STAGE_KEY) : 0
if (!promoteVersion) return curVersion // Updates the bot version only on the second stage and uses that version when promoted to the last stage
let nextVersion = curVersion + 1
await globalKvs.set(STAGE_KEY, nextVersion)
return nextVersion
}
const getStageId = () => [botId, bot.pipeline_status.stage_request.id].join(STAGE_SEPERATOR)
const getStageName = async () => {
let botName = bot.name.split(VERSION_SEPERATOR)[0]
let nextVersion = await getNextVersion()
return `${botName}${VERSION_SEPERATOR}${nextVersion}`
}
const handle = async () => {
let stageId = getStageId()
let stageName = await getStageName()
let botConfig = await bp.bots.getBotById(stageId)
if (botConfig) {
await bp.bots.createBotRevision(stageId)
}
bot.id = stageId
bot.name = stageName
}
handle() |
laurentlp
changed the title
Overriding a bot on a stage breaks DialogEngine and fails to update content-elements
[BUG] Overriding a bot on a stage breaks DialogEngine and fails to update content-elements
Jan 26, 2022
Reopening the issue since the same issue can be reproduced at 12.26.10 with Postgress DB here is a more complete on_stage_request hook
|
Available on v12.26.11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In a workspace with 3 pipeline stages when a bot on some stage is overridden (using
on_request_change
pipeline hook in a comment below):2. Chat stops working
May be related to this issue.
To Reproduce
Steps to reproduce the behavior:
3. Add some initial content to it
4. Promote the bot to the next stage
5. Promoted bot should work for now
6. Add some new content to the original bot and promote it again
7. Open the studio for the promoted bot. You should see newly added content-elements rendered empty and webchat not working
Expected behavior
The promoted bot should have a working webchat and render newly added content-elements in the flow editor
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: