Giter Site home page Giter Site logo

Comments (11)

agnescameron avatar agnescameron commented on July 30, 2024

ah hm i notice this from time to time: I remember this issue existing already but perhaps we thought it went away. I think maybe first noticed this a few weeks ago?

from bot_or_not.

cosmicespresso avatar cosmicespresso commented on July 30, 2024

ahh this is very elusive - it only seems to happen when the bot double-texts (never when it's the first response to a user message). When did you add that functionality?

from bot_or_not.

agnescameron avatar agnescameron commented on July 30, 2024

it's been there for a couple of months, but we're using it more now -- when there's punctuation in a bot's response, it splits the message in two and adds it to bot queue. It doesn't use anything special though: everything just goes through the bot queue.

recently I added in a 'line break' character that allows the bot to text over multiple lines without having punctuation to split them, which is probably why we're seeing this more.

from bot_or_not.

cosmicespresso avatar cosmicespresso commented on July 30, 2024

ohhh ok great thats helpful - yes the \n can totally be the culprit here

from bot_or_not.

agnescameron avatar agnescameron commented on July 30, 2024

ahhh it's not a \n though -- it's just appending 2 messages to the queue separately

from bot_or_not.

agnescameron avatar agnescameron commented on July 30, 2024

hmmmmmmm.... what it does is splits the sentence into an array, and concatenates that to the bot queue... which is maybe not quite the same

  processResponse = (text) => {
    //check if message pure punctuation, let it pass if so
    if (text.match(/[a-zA-Z]/g)){
      //breaks sentences into different messages
      text = text
        .match(/[^.!?%]+[.!?]*/g)
        .map(str => str.trim());
    }
    else if (!text) {
      text = handleError();
    }

    this.botQueue = this.botQueue.concat(text);

    // random pause before the bot starts typing, as if thinking
    setTimeout(() => this.setState({isBotTyping: true}, () => 
      this.processBotQueue()), this.getRandomInt(1100, 3500));
  }

from bot_or_not.

agnescameron avatar agnescameron commented on July 30, 2024

so the regex is looking for punctuation, or the 'newline' character %: if there's punctuation it splits and keeps the punctuation, if there's a % it splits and gets rid of the %.

from bot_or_not.

cosmicespresso avatar cosmicespresso commented on July 30, 2024

ok I will play a bit with that and report back

from bot_or_not.

agnescameron avatar agnescameron commented on July 30, 2024

yeah. there's also one tiny hack that I did to make the bot dots appear at the start of rounds (they only get appended once there are messages on the screen) that just appends a blank message, before the bot starts typing. but the dots aren't distorted underneath that I don't think (+ I feel like we'd already seen the dots getting displaced before that...)

that's done here:

      if(this.state.messages.length === 0) {
        //if start of interaction, adds a blank 
        //message to kickstart the 'bot dots'
        this.appendMessage('');
        this.processResponse(response); 
      }

from bot_or_not.

cosmicespresso avatar cosmicespresso commented on July 30, 2024

^ very likely this is the reason, but I'm also investigating whether the trim() function you are using has the results we want (whether it creates a new variable or operates on the existing one)

from bot_or_not.

cosmicespresso avatar cosmicespresso commented on July 30, 2024

image

from bot_or_not.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.