created bots and chat histories are not persisent
weipienlee opened this issue · comments
All saved bots and chats disappear at some point with both the older redis and current prostgres docker versions.
Latest situation:
- postgres-volume directory has been created
- during browser refresh or new tab everything “seems” to persist, but all gone with browser restart
- restart containers and browser not seems to persist everything
PS: used undocumented POSTGRES_PORT=5432, POSTGRES_DB=opengpts, POSTGRES_USER=postgres, POSTGRES_PASSWORD=postgres
PSS: running with docker on Apple silicon
found the problems:
- variable name mismatch: should all be
opengpts_user_id
(see below) - expiration is apparently by default a session
if (document.cookie.indexOf("user_id") === -1) {
document.cookie = `opengpts_user_id=${uuidv4()}`;
}
temporary solution - moving expiration date; will expire after month of no use:
const daysUntilExpiration = 30; // Number of days until cookie expiration
// Check if cookie exists
if (!document.cookie.includes("opengpts_user_id")) {
const expires = new Date(Date.now() + daysUntilExpiration * 24 * 60 * 60 * 1000).toUTCString(); // Set initial expiration date
document.cookie = `opengpts_user_id=${uuidv4()}; expires=${expires}; path=/`;
} else {
const cookieParts = document.cookie.split('; ').find(cookie => cookie.startsWith("opengpts_user_id="));
if (cookieParts) {
const existingCookie = cookieParts.split('=');
const userId = existingCookie[1];
const expires = new Date(Date.now() + daysUntilExpiration * 24 * 60 * 60 * 1000).toUTCString(); // Reset expiration date
document.cookie = `opengpts_user_id=${userId}; expires=${expires}; path=/`;
}
}
Same here, all saved bots and chats disappear at some point. Persistence is required! Thank you!
Hi @weipienlee and @minovc3 ,
Thanks for the feedback. Current user authentication mechanism is a bit weak. We are working on improving the situation. That should also make the bots and chats persistent work reliably.