Coder Social home page Coder Social logo

Append for useAssistant about ai HOT 7 CLOSED

AlexIsMaking avatar AlexIsMaking commented on June 17, 2024
Append for useAssistant

from ai.

Comments (7)

lgrammel avatar lgrammel commented on June 17, 2024 1

Available in v3.0.25

from ai.

lgrammel avatar lgrammel commented on June 17, 2024 1

@AlexIsMaking thanks for letting me know. it seems i dropped it by accident during the change

from ai.

brian-yates avatar brian-yates commented on June 17, 2024 1

Hello - I have a question and possible bug regarding the append function in the useAssistant hook. It seems that calling append will add a message to the messages property (e.g. setMessages(prev => [...prev, newMessage])), but it calls the API endpoint with whatever the current input value is, regardless of what you called append with.

I would expect that calling append would call the API with the respective appended message content.

For additional context, I am adding prompts to the chat form that a user can click which would automatically send a message with the prompt content, rather than having to manually type out the message...and it seems like append is the perfect method to do this...it just doesn't work like I would expect.

Is this a bug or is it expected behavior?

Edit: this seems to be fixed...just had to upgrade to ai version 3.1.0

from ai.

lgrammel avatar lgrammel commented on June 17, 2024

#1407

from ai.

AlexIsMaking avatar AlexIsMaking commented on June 17, 2024

@lgrammel really grateful for the quick implementation here. When I use append, the status helper variable isn't set to in_progress though, is that expected behaviour?

At the moment, I'm relying on that status changing to trigger storage of user & assistant messages, since useAssistant doesn't have useChat's onFinish callback option.

from ai.

lgrammel avatar lgrammel commented on June 17, 2024

#1423

from ai.

saintpepsicola avatar saintpepsicola commented on June 17, 2024

Thanks. I just ran into the bug lol @brian-yates

from ai.

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.