Mixed language response
# 🤝help
r
all my main raw inputs are covered with:
Copy code
const supportedLanguages = ['iw', 'en']
const languageCode = user.TranslatorAgent.language || ''
const lastUserMessage = event.tags.message?.previous?.text || ''
const detectedLanguage = lastUserMessage.match(/[a-zA-Z]/g)?.join('') || languageCode
const languageDetector = supportedLanguages.includes(detectedLanguage) ? detectedLanguage : languageCode
workflow.LanguageDetector = languageDetector

user.TranslatorAgent.language = workflow.LanguageDetector
to catch and translate only to hebrew or english by code, works perfect in the emulator but not on live...it mixes both together
r
@rhythmic-lizard-47527 can you send us a screenshot of a conversation? Any reason why you need the piece of code above other than restrict languages to either hebrew or english? also, are you trying to support language switching in the middle of conversations, or is it set at the beginning and won't change after?
All bots kb and questions are written in English and translated to Hebrew for outsourcing our bots to a no Hebrew reader developer
we wanted that each time user will have a raw input it will detect and change it
it works great until it goes to "form" section
the translator is on 'iw' or 'he' (both are hebrew) and the messages come up in english
this is something that we cant solve for long time, we dont understand if its kb\botpress\openai problem, sometimes it realy works wonderful, but those self changes are happening a lot
Reminder: it starts with a trigger to node that reset language to 'iw' (its hebrew) that triggers the translator agent at the beggining for a Hebrew only openning
and about your question: "also, are you trying to support language switching in the middle of conversations?" Yes that what we are have done here , and it work good in emulator but not on live
r
I'd be curious to see this working if you remove all manual reset of the user language? In theory that's the job of the Translator Agent Are both options checked in the agent? https://cdn.discordapp.com/attachments/1227298071554297917/1227308520777580604/image.png?ex=6627ef21&is=66157a21&hm=835636deeadf28cfc24212c8a19453871d76ea182d4e3bbdde7297539c3832e0&
r
I know, but it dont works at all
this why we do it by code
r
When is the last time you tried it? It received an update last week and it got much better
r
about a month
it just skips
r
got it, would you mind trying again and if it still fails at some places, i can assist directly at making better
oh you mean skips because the tokens are too low?
r
it just dont do nothing and skips to next node
r
the translator agent doesn't ask anything – it just does background detection and responds in the same language as the user speaks in
r
I have tried it a lot of time are you sure it can work now?
r
it's hard to say, i don't really have any idea of what "didn't work" before?
all i know if that the way you're doing it now doesn't really scale well (having to check/adjust language at every single input)
r
no its not working again
I can upload the project file here if it can give you more info
It can help us a lot if you can give us a tip how to make it work and getting the issue to be solved
we want to sell the bots heavily but afraid of those random changes in language
@rich-battery-69172
I ask on hebrew it answer english
r
can you share a link to the webchat? also a report id @square-energy-41150
r
And a one time before it worked
s
# Sending a Problem Report Here's how to send the Botpress Team a problem report: 1. In the Botpress Cloud Studio, locate the "Help" icon in the bottom left corner of the screen. 2. Click "Report a problem" and follow the steps on the screen. 3. Copy the Report ID to your clipboard and provide it to a member of the Botpress Team on Discord.
r
thanks, are you fine with me accessing your bot directly?
r
report_01HV1ZKC2QA8NC0K7S1K2PTH4H
Sure if it can help me with solving this forever 🤞
how can we do it?
r
i get access with the report id
r
oh wow, i see the problem
r
would like to know please
r
sorry still looking into this
r
thank you for your help
r
@rhythmic-lizard-47527 A fix has been deployed, can you try again and confirm if this works on your side? BTW you should be able to delete all your custom logic for language setting. I did on my side with a copy of your bot and it worked fine.
I basically deleted all the execute code cards with language setting inside
r
how can i see that?
or just delete them?
what are the changes? what about the language of the knowledge base or question they should stay as they are now?
r
what do you mean?
yeah just delete all the logic about custom language setting. The translator agent can do it all automatically
r
The fix that was deployed?
r
Yes.
r
The fix is to delete them? or there is a system update?
r
There's been a system update
It was an issue with the webchat buttons. The button was sending the payload in english even if the button label was hebrew. That made the bot switch back to english (rightfully so).
r
Huge thank you @rich-battery-69172!
will check it