FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow
https://flowiseai.com
Apache License 2.0
30.3k stars 15.66k forks source link

Is this a bug? Session id Memory #2031

Closed toi500 closed 6 months ago

toi500 commented 6 months ago

I notice that when you set up a Session id for a Memory Module, lets say Session Id=Test, it only works from the UI Source:

--

Screenshot 2024-03-25 205740

--

But if you try the same chatbot from the API/EMBED source, the Session id is random.

--

Screenshot 2024-03-25 205918

--

If this is not a bug, what is the point to set up a custom Session id?

It would be very useful if the bot is only being used for 1 user, so they have all the data grouped.

saatchi-david commented 6 months ago

@toi500 I'm experiencing the same when setting a session ID in the Zep memory node. I also expected the set ID to be used everywhere.

toi500 commented 6 months ago

@saatchi-david

Apparently it is a thing for all memory nodes. I got this issue with the Zep memory node too and then I tried the Upstash one with the same results.

HenryHengZJ commented 6 months ago

I just tried it seems to work.. I have set a session ID on the memory node:

image

I then make a call to the API:

image

I can see the session ID in View Messages:

image
toi500 commented 6 months ago

@HenryHengZJ

Please try to inject the embed script of your testing chatflow to a html file and test it from the font end, that is how I reproduce the bug. I got my flowise instance on Railway, but i dont think this is relevant.

Just tested and got the same buggy results than before. Please check the id:

Screenshot 2024-03-30 155827 Screenshot 2024-03-30 155844

I also get it right via postman

Screenshot 2024-03-30 164144

HenryHengZJ commented 6 months ago

What does your embedded script looks like? @toi500

toi500 commented 6 months ago

Screenshot 2024-03-30 194952 Screenshot 2024-03-30 195142

Screenshot 2024-03-30 195229

Screenshot 2024-03-30 195407

HenryHengZJ commented 6 months ago

@toi500 for a workaround, since you have hard-coded the sessionId on the UI, you can also do so in the embed script:

<script type="module">
    import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
    Chatbot.init({
        chatflowid: '80612c28-aae1-446d-8d73-58dfd998d565',
        apiHost: 'http://localhost:3000',
        chatflowConfig: {
            sessionId: "abcde"
        }
    });
  </script>
toi500 commented 6 months ago

It worked. Thank you for that, I really appreciate it.

So, is this sort of buggy or we do need to overwrite the session id via the embed script too?

HenryHengZJ commented 6 months ago

This is the current design, you'll have to provide sessionId in the chatflow config for embedded, hard coded sessionId is meant for user to test it on UI

toi500 commented 6 months ago

Makes sense. Thank you for the clarification, I really appreciate it.