Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[QUESTION] Get Messages Using Specific Chat ID - API

Open BrianMoreno1994 opened this issue 2 years ago • 5 comments

I would like to use the API to get the history of a specific chat id.

This way I can get the history of the conversation and prepend that to the current conversation.

Does the API currently have an endpoint to do this? I checked the docs but can't seem to find any relevant information.

BrianMoreno1994 avatar Jun 11 '24 23:06 BrianMoreno1994

To access the history of a specific chat using a chat ID, you will need to use the API of the memory platform integrated with your Flowise system, not directly the Flowise API itself. The Flowise API typically manages workflows and automations, but to access specific data from previous conversations, you need an API that supports storage and retrieval operations for conversation memory. Check the documentation of your memory solution or contact me for details on specific endpoints that allow you to retrieve chat history based on the chat ID.

rafaeljuniorvip avatar Jun 12 '24 00:06 rafaeljuniorvip

To access the history of a specific chat using a chat ID, you will need to use the API of the memory platform integrated with your Flowise system, not directly the Flowise API itself. The Flowise API typically manages workflows and automations, but to access specific data from previous conversations, you need an API that supports storage and retrieval operations for conversation memory. Check the documentation of your memory solution or contact me for details on specific endpoints that allow you to retrieve chat history based on the chat ID.

Hi @rafaeljuniorvip, I started by using the SQL Prompt template from the flowise marketplace and made a couple of tweaks to make it work with my database and my tables in that database. The last node in the flow is a LLM Chain node, which doesn't seem to allow a memory node to be attached to it, can you guide me as to what I should do in this case?

BrianMoreno1994 avatar Jun 12 '24 17:06 BrianMoreno1994

are you looking for this - https://docs.flowiseai.com/using-flowise/api#id-3.-message-api ?

HenryHengZJ avatar Jun 12 '24 20:06 HenryHengZJ

are you looking for this - https://docs.flowiseai.com/using-flowise/api#id-3.-message-api ?

@HenryHengZJ I saw that endpoint, but when using it I get the following error message:

[ERROR]: unhandledRejection:  SQLITE_CONSTRAINT: NOT NULL constraint failed: chat_message.role
QueryFailedError: SQLITE_CONSTRAINT: NOT NULL constraint failed: chat_message.role
    at Statement.handler (/usr/local/lib/node_modules/flowise/node_modules/typeorm/driver/sqlite/SqliteQueryRunner.js:88:37)

BrianMoreno1994 avatar Jun 13 '24 18:06 BrianMoreno1994

are you looking for this - https://docs.flowiseai.com/using-flowise/api#id-3.-message-api ?

@HenryHengZJ I saw that endpoint, but when using it I get the following error message:

[ERROR]: unhandledRejection:  SQLITE_CONSTRAINT: NOT NULL constraint failed: chat_message.role
QueryFailedError: SQLITE_CONSTRAINT: NOT NULL constraint failed: chat_message.role
    at Statement.handler (/usr/local/lib/node_modules/flowise/node_modules/typeorm/driver/sqlite/SqliteQueryRunner.js:88:37)

Looks like your chat_message table was somehow corrupted, I'd say try using Flowise on a new database. Feel free to reopen if issue persists

HenryHengZJ avatar Nov 08 '24 20:11 HenryHengZJ